View backup.sh
This file contains 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
d="$(date -d -now)" | |
mkdir backup/"$d" | |
cp -r /var/www/html/* backup/"$d" |
View mail.php
This file contains 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
< ?php | |
// the message | |
$msg = "First line of textnSecond line of text"; | |
// use wordwrap() if lines are longer than 70 characters | |
$msg = wordwrap($msg,70); | |
// send email | |
mail("someone@example.com","My subject",$msg); | |
? > |
View backup-hdd.sh
This file contains 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
dd bs=4096 conv=noerror,sync if=/dev/sdc1 | gzip -c > img.gz |
View upload.php
This file contains 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
//upload code | |
$filename=$_FILE['name']['filename_in_html']; //you can change this with your filename | |
$allowed='png,jpg'; //which file types are allowed seperated by comma | |
$extension_allowed= explode(',', $allowed); | |
$file_extension= pathinfo($filename, PATHINFO_EXTENSION); | |
if(array_search($file_extension, $extension_allowed)) | |
{ | |
echo "$extension_allowed allowed for uploading file"; | |
} |
View add-all-empty-directory-git.sh
This file contains 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
#This shell script will find all empty directories and sub-directories in a project folder and creates a .gitkeep file, so that the empty directory | |
#can be added to the git index. | |
find * -type d -empty -exec touch {}/.gitkeep \; |
View get_sources.sh
This file contains 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
wget http://download.savannah.gnu.org/releases/acl/acl-2.2.52.src.tar.gz | |
wget http://download.savannah.gnu.org/releases/attr/attr-2.4.47.src.tar.gz | |
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz | |
wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz | |
wget http://ftp.gnu.org/gnu/bash/bash-4.3.30.tar.gz | |
wget http://alpha.gnu.org/gnu/bc/bc-1.06.95.tar.bz2 | |
wget http://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.bz2 | |
wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.xz | |
wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz | |
wget http://sourceforge.net/projects/check/files/check/0.10.0/check-0.10.0.tar.gz |
View sri.go
This file contains 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
package sri | |
import ( | |
"crypto/sha256" | |
"encoding/base64" | |
"fmt" | |
"io/ioutil" | |
) | |
func Generate256(file string) (string, error) { |
View english-words.py
This file contains 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
from nltk.corpus import wordnet #Using Natural language toolkit (http://www.nltk.org/) | |
import codecs | |
def check(str): | |
if not wordnet.synsets(str): | |
return 1 | |
else: | |
return 0 | |
a=0 | |
if __name__ == '__main__': |
View multiprocessing.py
This file contains 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
import multiprocessing as mp | |
process_list = [] | |
def pr1(test,test1): | |
""" | |
@:param: test,test1 (Integer) | |
process 1 | |
""" | |
print("Pr 1 prining... '"+str(test)+"','"+str(test1)+"' recieved...") |
View lib.py
This file contains 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
import threading | |
x=0 #to get a random number | |
killswitch = False # To kill thread after use | |
def threaded_return(que): | |
""" | |
Returning data from thread safely (Returns current value of x) | |
:param que: | |
:return: | |
""" | |
global x |
OlderNewer