This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/bin/bash | |
| # 1) create function to get current Unix Epoch Time | |
| EPOCHTIME () { date -u +%s; } | |
| # $ EPOCHTIME | |
| # 1378623423 | |
| # $ EPOCHTIME | |
| # 1378623429 | |
| # 2) get Unix Epoch Time at 12am on January 1, 2001, as STATIC variable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/bin/bash | |
| # not an actual script - these are only commands, but the script would be basically the same. | |
| # requires jailbroken iOS device | |
| # get into the filesystem | |
| ssh root:alpine@iphone | |
| # update your package list, and install sqlite | |
| apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # touch | |
| ## doesn't work on read-only files | |
| type nul >>file & copy file +,, | |
| ## for read-only files, use the following: | |
| :touch | |
| if not exist "%~1" type nul >>"%~1"& goto :eof | |
| set _ATTRIBUTES=%~a1 | |
| if "%~a1"=="%_ATTRIBUTES:r=%" (copy "%~1"+,,) else attrib -r "%~1" & copy "%~1"+,, & attrib +r "%~1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if exist {insert file name here} ( | |
| rem file exists | |
| ) else ( | |
| rem file doesn't exist | |
| ) | |
| # or on a single line (if only a single action needs to occur): | |
| if exist {insert file name here} {action} | |
| # a quick little example testing for both files and/or directories: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !#/bin/bash | |
| if [ ! -f /tmp/foo.txt ]; then | |
| echo "File not found!" | |
| fi | |
| # for directories: | |
| if [ -d "$DIRECTORY" ]; then | |
| # Control will enter here if $DIRECTORY exists. | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| curl -o lgllc.tar.gz -b cookies.txt --user-agent "Mozilla/5.0" --user user:pass -k https://[host]:[port]/[filename] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo dscacheutil -flushcache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo killall -HUP mDNSResponder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| nl=$'\n'; cat "hello.txt" | sed -E "s/(<img.+src=\")(.+)(\".+)/\1\\$nl\2\\$nl\3/g" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| mplayer -vo null -vc null -ao pcm:fast:file=file.wav file.mp3; faac -b 128 -c 44100 -w file.wav |