diff --git a/index.html b/index.html index a56cef0..685f5cd 100644 --- a/index.html +++ b/index.html @@ -135,7 +135,7 @@
Linux
-
find /var/log/ "*log" -follow | egrep '*log$' | xargs tail -n 0 -f | grep -v '^$'
+
find /var/log/ -name "*log" -type f -follow | xargs tail -n 0 -f | grep -v '^$'

diff --git a/params.json b/params.json index c7730a2..7a9c489 100644 --- a/params.json +++ b/params.json @@ -1 +1 @@ -{"name":"rm -rf /","tagline":"by NeQuissimus","body":"# Revert ESXi snapshot from the CLI\r\n##### (Aug 25, 2015)\r\n###### ESXi, VMware\r\n\r\n```bash\r\n$ vim-cmd vmsvc/getallvms\r\n```\r\n\r\nVMID is the first column\r\n\r\n```bash\r\n$ vim-cmd vmsvc/snapshot.get ${VMID}\r\n```\r\n\r\nFind snapshot ID\r\n\r\n```bash\r\n$ vim-cmd vmsvc/snapshot.revert ${VMID} ${SNAPID} false\r\n```\r\n\r\n---\r\n\r\n# Grab images from Instagram app\r\n##### (Mar 31, 2015)\r\n###### Android\r\n\r\n```bash\r\n$ adb root\r\n$ mkdir ~/Downloads/instagram\r\n$ adb pull /data/data/com.instagram.android/cache ~/Downloads/instagram\r\n$ find ~/Downloads/instagram -name '*.0' -exec mv {} {}.jpg \\;\r\n$ open ~/Downloads/instagram\r\n```\r\n\r\n---\r\n\r\n# Show Mac CPU model\r\n##### (Feb 7, 2015)\r\n###### OSX\r\n\r\n```bash\r\n$ sysctl -n machdep.cpu.brand_string\r\nIntel(R) Core(TM) i7-3770S CPU @ 3.10GHz\r\n```\r\n\r\n---\r\n\r\n# Run IntelliJ IDEA without Java 1.6\r\n##### (Dec 30, 2014)\r\n###### Java, OSX\r\n\r\n- Open `/Applications/IntelliJ\\ IDEA\\ 14\\ CE.app/Contents/Info.plist`\r\n- Find `JVMVersion`\r\n- Change the value from `1.6*` to `1.8*`\r\n\r\n---\r\n\r\n# Find class file version\r\n##### (Dec 15, 2014)\r\n###### Java\r\n\r\n```bash\r\n$ od -x ~/dev/Test.class | head -1\r\n0000000 feca beba 0000 3200 4200 0007 073d 3e00\r\n```\r\n\r\nThe 3200 signals JDK 1.6, 3100 would be 1.5 etc.\r\n\r\n---\r\n\r\n# Follow log files\r\n##### (Dec 4, 2014)\r\n###### Linux\r\n\r\n```bash\r\nfind /var/log/ \"*log\" -follow | egrep '*log$' | xargs tail -n 0 -f | grep -v '^$'\r\n```\r\n\r\n---\r\n\r\n# Change JVM from command line\r\n##### (Nov 12, 2014)\r\n###### Java, OSX\r\n\r\n```bash\r\nfunction setjdk() {\r\n if [ $# -ne 0 ]; then\r\n removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'\r\n if [ -n \"${JAVA_HOME+x}\" ]; then\r\n removeFromPath $JAVA_HOME\r\n fi\r\n export JAVA_HOME=`/usr/libexec/java_home -v $@`\r\n export PATH=$JAVA_HOME/bin:$PATH\r\n fi\r\n}\r\n\r\nfunction removeFromPath() {\r\n export PATH=\"$(echo \"$PATH\" | sed -E -e \"s;:$1;;\" -e \"s;$1:?;;\")\"\r\n}\r\n\r\nsetjdk 1.9\r\n```\r\n\r\n_[Source](http://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/)_\r\n\r\n---\r\n\r\n# MySQL prompt\r\n##### (Nov 12, 2014)\r\n###### MySQL\r\n\r\n```bash\r\nexport MYSQL_PS1=\"\\u@\\d> \"\r\n```\r\n\r\n---\r\n\r\n# Single-line git commit history\r\n##### (Jul 28, 2014)\r\n###### git\r\n\r\n```bash\r\ngit config --global alias.lg \"log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all\"\r\n```\r\n\r\n```bash\r\ngit lg\r\n```\r\n\r\n---\r\n\r\n# Send plain-text messages via UDP\r\n##### (Jul 24, 2014)\r\n###### shell\r\n\r\n```bash\r\necho \"Test\" | socat -u STDIO UDP-DATAGRAM:127.0.0.1:514\r\n```\r\n\r\n---\r\n\r\n# Compare files with comm\r\n##### (Jul 24, 2014)\r\n###### shell\r\n\r\n```bash\r\n# First column: Lines unique to file1\r\n# Second column: Lines unique to file2\r\n# Third column: Lines common to both files\r\n$ comm file1 file2\r\n```\r\n\r\n```bash\r\n# Hide all columns (1, 2 & 3; which makes no sense!)\r\n$ comm -123 file1 file2\r\n \r\n# Only show common lines\r\n$ comm -12 file1 file2\r\n```\r\n\r\n---\r\n\r\n# Revert Subversion merge\r\n##### (Apr 16, 2014)\r\n###### Subversion\r\n\r\n```bash\r\nsvn merge -c -REVISION .\r\n```\r\n\r\n---\r\n\r\n# Send/Receive SNMP traps\r\n##### (Sep 17, 2013)\r\n###### OSX, Linux\r\n\r\n_~/.snmp/snmptrapd.conf_\r\n\r\n```bash\r\ndisableAuthorization yes\r\ncom2sec local 127.0.0.1/32 public\r\ncom2sec local 10.30.68.0/24 public\r\nview all included .1\r\n```\r\n\r\n_Start receiver_\r\n\r\n```bash\r\nsudo snmptrapd -Lf ~/.snmp/output.txt\r\n```\r\n\r\n_Send sample trap_\r\n\r\n```bash\r\nsudo snmptrap -v 2c -c public -m ALL localhost \"\" SNMPv2-MIB::sysLocation.0 s s \"Hello World\"\r\n```\r\n\r\n---\r\n\r\n# Change .NET framework in Powershell\r\n##### (Sep 17, 2013)\r\n###### Windows\r\n\r\n```xml\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n```\r\n\r\n---\r\n\r\n# Path to .NET Framework\r\n##### (Sep 17, 2013)\r\n###### Windows\r\n\r\n```powershell\r\nfunction Get-FrameworkDirectory {\r\n $([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())\r\n}\r\n```\r\n\r\n---\r\n\r\n# Copy files with progress\r\n##### (Sep 16, 2013)\r\n###### OSX, Linux\r\n\r\n```bash\r\nalias cp='rsync --progress'\r\n```\r\n\r\n---\r\n\r\n# Remove key from known_hosts\r\n##### (Sep 16, 2013)\r\n###### OSX, Linux\r\n\r\n```bash\r\nssh-keygen -R HOST\r\n```\r\n\r\n---\r\n\r\n# MySQL log\r\n##### (Sep 16, 2013)\r\n###### MySQL\r\n\r\n_my.cnf.51_\r\n\r\n```\r\nlog=/var/log/mysql/mysql.log\r\n```\r\n\r\n_my.cnf.56_\r\n\r\n```\r\ngeneral_log=true\r\ngeneral_log_file=/var/log/mysql/mysql.log\r\n```\r\n\r\n---\r\n\r\n# Prevent Spotlight indexing \r\n##### (Mar 29, 2013)\r\n###### OSX\r\n\r\n```bash\r\ntouch /Volumes/MyDrive/.metadata_never_index\r\n```\r\n\r\n---\r\n\r\n# List/Clear downloaded files list in OSX\r\n##### (Jan 19, 2013)\r\n###### OSX\r\n\r\n_List_\r\n\r\n```bash\r\nsqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 'select LSQuarantineDataURLString from LSQuarantineEvent'\r\n```\r\n\r\n_Empty_\r\n\r\n```bash\r\nsqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEvents* 'delete from LSQuarantineEvent'\r\n```\r\n\r\n---\r\n\r\n# Rebuild context menu entries\r\n##### (Aug 22, 2012)\r\n###### OSX\r\n\r\n```bash\r\n/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user\r\n```\r\n\r\n---\r\n\r\n# Limit bandwidth\r\n##### (Apr 19, 2012)\r\n###### OSX\r\n\r\n_Add_\r\n\r\n```bash\r\nipfw pipe 1 config bw 100KB\r\nipfw add 1 pipe 1 src-port any\r\n```\r\n\r\n_Remove_\r\n\r\n```bash\r\nipfw delete 00001\r\n```\r\n\r\n---\r\n\r\n# Headless VMware Fusion\r\n##### (Feb 17, 2012)\r\n###### OSX, VMware Fusion\r\n\r\n```bash\r\n/Library/Application\\ Support/VMware\\ Fusion/vmrun -T fusion start /Volumes/VMs/_Hadoop/Hadoop\\ Master.vmwarevm/Hadoop\\ Master.vmx nogui\r\n```\r\n\r\n---\r\n\r\n# Hide/Show ~/Library\r\n##### (Jul 21, 2011)\r\n###### OSX\r\n\r\n```bash\r\nchflags [nohidden|hidden] ~/Library\r\n```\r\n\r\n---\r\n\r\n# Force login via RDP\r\n##### (Mar 11, 2011)\r\n###### Windows\r\n\r\n```\r\nmstsc /v:123.123.123.123 /admin\r\n```\r\n\r\n---\r\n\r\n# Blank Dock.app icon\r\n##### (Feb 12, 2011)\r\n###### OSX\r\n\r\n```bash\r\ndefaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type=\"spacer-tile\";}'\r\nkillall Dock\r\n```\r\n\r\n---\r\n\r\n# Rebuild Spotlight index\r\n##### (Oct 6, 2010)\r\n###### OSX\r\n\r\n```bash\r\nsudo mdutil -E /\r\n```\r\n\r\n---\r\n\r\n# Trigger OSX maintenance scripts\r\n##### (Sep 21, 2010)\r\n###### OSX\r\n\r\n```bash\r\nsudo periodic daily weekly monthly\r\n```\r\n\r\n---","google":"UA-31449022-1","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file +{"name":"rm -rf /","tagline":"by NeQuissimus","body":"# Revert ESXi snapshot from the CLI\r\n##### (Aug 25, 2015)\r\n###### ESXi, VMware\r\n\r\n```bash\r\n$ vim-cmd vmsvc/getallvms\r\n```\r\n\r\nVMID is the first column\r\n\r\n```bash\r\n$ vim-cmd vmsvc/snapshot.get ${VMID}\r\n```\r\n\r\nFind snapshot ID\r\n\r\n```bash\r\n$ vim-cmd vmsvc/snapshot.revert ${VMID} ${SNAPID} false\r\n```\r\n\r\n---\r\n\r\n# Grab images from Instagram app\r\n##### (Mar 31, 2015)\r\n###### Android\r\n\r\n```bash\r\n$ adb root\r\n$ mkdir ~/Downloads/instagram\r\n$ adb pull /data/data/com.instagram.android/cache ~/Downloads/instagram\r\n$ find ~/Downloads/instagram -name '*.0' -exec mv {} {}.jpg \\;\r\n$ open ~/Downloads/instagram\r\n```\r\n\r\n---\r\n\r\n# Show Mac CPU model\r\n##### (Feb 7, 2015)\r\n###### OSX\r\n\r\n```bash\r\n$ sysctl -n machdep.cpu.brand_string\r\nIntel(R) Core(TM) i7-3770S CPU @ 3.10GHz\r\n```\r\n\r\n---\r\n\r\n# Run IntelliJ IDEA without Java 1.6\r\n##### (Dec 30, 2014)\r\n###### Java, OSX\r\n\r\n- Open `/Applications/IntelliJ\\ IDEA\\ 14\\ CE.app/Contents/Info.plist`\r\n- Find `JVMVersion`\r\n- Change the value from `1.6*` to `1.8*`\r\n\r\n---\r\n\r\n# Find class file version\r\n##### (Dec 15, 2014)\r\n###### Java\r\n\r\n```bash\r\n$ od -x ~/dev/Test.class | head -1\r\n0000000 feca beba 0000 3200 4200 0007 073d 3e00\r\n```\r\n\r\nThe 3200 signals JDK 1.6, 3100 would be 1.5 etc.\r\n\r\n---\r\n\r\n# Follow log files\r\n##### (Dec 4, 2014)\r\n###### Linux\r\n\r\n```bash\r\nfind /var/log/ -name \"*log\" -type f -follow | xargs tail -n 0 -f | grep -v '^$'\r\n```\r\n\r\n---\r\n\r\n# Change JVM from command line\r\n##### (Nov 12, 2014)\r\n###### Java, OSX\r\n\r\n```bash\r\nfunction setjdk() {\r\n if [ $# -ne 0 ]; then\r\n removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'\r\n if [ -n \"${JAVA_HOME+x}\" ]; then\r\n removeFromPath $JAVA_HOME\r\n fi\r\n export JAVA_HOME=`/usr/libexec/java_home -v $@`\r\n export PATH=$JAVA_HOME/bin:$PATH\r\n fi\r\n}\r\n\r\nfunction removeFromPath() {\r\n export PATH=\"$(echo \"$PATH\" | sed -E -e \"s;:$1;;\" -e \"s;$1:?;;\")\"\r\n}\r\n\r\nsetjdk 1.9\r\n```\r\n\r\n_[Source](http://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/)_\r\n\r\n---\r\n\r\n# MySQL prompt\r\n##### (Nov 12, 2014)\r\n###### MySQL\r\n\r\n```bash\r\nexport MYSQL_PS1=\"\\u@\\d> \"\r\n```\r\n\r\n---\r\n\r\n# Single-line git commit history\r\n##### (Jul 28, 2014)\r\n###### git\r\n\r\n```bash\r\ngit config --global alias.lg \"log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all\"\r\n```\r\n\r\n```bash\r\ngit lg\r\n```\r\n\r\n---\r\n\r\n# Send plain-text messages via UDP\r\n##### (Jul 24, 2014)\r\n###### shell\r\n\r\n```bash\r\necho \"Test\" | socat -u STDIO UDP-DATAGRAM:127.0.0.1:514\r\n```\r\n\r\n---\r\n\r\n# Compare files with comm\r\n##### (Jul 24, 2014)\r\n###### shell\r\n\r\n```bash\r\n# First column: Lines unique to file1\r\n# Second column: Lines unique to file2\r\n# Third column: Lines common to both files\r\n$ comm file1 file2\r\n```\r\n\r\n```bash\r\n# Hide all columns (1, 2 & 3; which makes no sense!)\r\n$ comm -123 file1 file2\r\n \r\n# Only show common lines\r\n$ comm -12 file1 file2\r\n```\r\n\r\n---\r\n\r\n# Revert Subversion merge\r\n##### (Apr 16, 2014)\r\n###### Subversion\r\n\r\n```bash\r\nsvn merge -c -REVISION .\r\n```\r\n\r\n---\r\n\r\n# Send/Receive SNMP traps\r\n##### (Sep 17, 2013)\r\n###### OSX, Linux\r\n\r\n_~/.snmp/snmptrapd.conf_\r\n\r\n```bash\r\ndisableAuthorization yes\r\ncom2sec local 127.0.0.1/32 public\r\ncom2sec local 10.30.68.0/24 public\r\nview all included .1\r\n```\r\n\r\n_Start receiver_\r\n\r\n```bash\r\nsudo snmptrapd -Lf ~/.snmp/output.txt\r\n```\r\n\r\n_Send sample trap_\r\n\r\n```bash\r\nsudo snmptrap -v 2c -c public -m ALL localhost \"\" SNMPv2-MIB::sysLocation.0 s s \"Hello World\"\r\n```\r\n\r\n---\r\n\r\n# Change .NET framework in Powershell\r\n##### (Sep 17, 2013)\r\n###### Windows\r\n\r\n```xml\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n```\r\n\r\n---\r\n\r\n# Path to .NET Framework\r\n##### (Sep 17, 2013)\r\n###### Windows\r\n\r\n```powershell\r\nfunction Get-FrameworkDirectory {\r\n $([System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())\r\n}\r\n```\r\n\r\n---\r\n\r\n# Copy files with progress\r\n##### (Sep 16, 2013)\r\n###### OSX, Linux\r\n\r\n```bash\r\nalias cp='rsync --progress'\r\n```\r\n\r\n---\r\n\r\n# Remove key from known_hosts\r\n##### (Sep 16, 2013)\r\n###### OSX, Linux\r\n\r\n```bash\r\nssh-keygen -R HOST\r\n```\r\n\r\n---\r\n\r\n# MySQL log\r\n##### (Sep 16, 2013)\r\n###### MySQL\r\n\r\n_my.cnf.51_\r\n\r\n```\r\nlog=/var/log/mysql/mysql.log\r\n```\r\n\r\n_my.cnf.56_\r\n\r\n```\r\ngeneral_log=true\r\ngeneral_log_file=/var/log/mysql/mysql.log\r\n```\r\n\r\n---\r\n\r\n# Prevent Spotlight indexing \r\n##### (Mar 29, 2013)\r\n###### OSX\r\n\r\n```bash\r\ntouch /Volumes/MyDrive/.metadata_never_index\r\n```\r\n\r\n---\r\n\r\n# List/Clear downloaded files list in OSX\r\n##### (Jan 19, 2013)\r\n###### OSX\r\n\r\n_List_\r\n\r\n```bash\r\nsqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 'select LSQuarantineDataURLString from LSQuarantineEvent'\r\n```\r\n\r\n_Empty_\r\n\r\n```bash\r\nsqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEvents* 'delete from LSQuarantineEvent'\r\n```\r\n\r\n---\r\n\r\n# Rebuild context menu entries\r\n##### (Aug 22, 2012)\r\n###### OSX\r\n\r\n```bash\r\n/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user\r\n```\r\n\r\n---\r\n\r\n# Limit bandwidth\r\n##### (Apr 19, 2012)\r\n###### OSX\r\n\r\n_Add_\r\n\r\n```bash\r\nipfw pipe 1 config bw 100KB\r\nipfw add 1 pipe 1 src-port any\r\n```\r\n\r\n_Remove_\r\n\r\n```bash\r\nipfw delete 00001\r\n```\r\n\r\n---\r\n\r\n# Headless VMware Fusion\r\n##### (Feb 17, 2012)\r\n###### OSX, VMware Fusion\r\n\r\n```bash\r\n/Library/Application\\ Support/VMware\\ Fusion/vmrun -T fusion start /Volumes/VMs/_Hadoop/Hadoop\\ Master.vmwarevm/Hadoop\\ Master.vmx nogui\r\n```\r\n\r\n---\r\n\r\n# Hide/Show ~/Library\r\n##### (Jul 21, 2011)\r\n###### OSX\r\n\r\n```bash\r\nchflags [nohidden|hidden] ~/Library\r\n```\r\n\r\n---\r\n\r\n# Force login via RDP\r\n##### (Mar 11, 2011)\r\n###### Windows\r\n\r\n```\r\nmstsc /v:123.123.123.123 /admin\r\n```\r\n\r\n---\r\n\r\n# Blank Dock.app icon\r\n##### (Feb 12, 2011)\r\n###### OSX\r\n\r\n```bash\r\ndefaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type=\"spacer-tile\";}'\r\nkillall Dock\r\n```\r\n\r\n---\r\n\r\n# Rebuild Spotlight index\r\n##### (Oct 6, 2010)\r\n###### OSX\r\n\r\n```bash\r\nsudo mdutil -E /\r\n```\r\n\r\n---\r\n\r\n# Trigger OSX maintenance scripts\r\n##### (Sep 21, 2010)\r\n###### OSX\r\n\r\n```bash\r\nsudo periodic daily weekly monthly\r\n```\r\n\r\n---","google":"UA-31449022-1","note":"Don't delete this file! It's used internally to help with page regeneration."} \ No newline at end of file