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 hashlib | |
h = hashlib.new('sha256') | |
h.update(str) | |
print h.hexdigest() |
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
#Open firewall for port | |
FW_PORT=9877 | |
iptables -I INPUT 1 -p tcp -m tcp --dport $FW_PORT -j ACCEPT | |
iptables -I INPUT 1 -p tcp -m tcp --sport $FW_PORT -j ACCEPT | |
iptables -I OUTPUT 1 -p tcp -m tcp --sport $FW_PORT -j ACCEPT | |
iptables -I OUTPUT 1 -p tcp -m tcp --dport $FW_PORT -j ACCEPT | |
#save firewall rules | |
/sbin/service iptables save | |
/sbin/service iptables restart |
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
#!/bin/sh | |
#change string in file | |
if [[ $# -ne 3 ]]; then | |
echo "Wrong number of arguments" | |
echo "Usage: $0 FILE FROMSTRING TOSTRING" | |
exit 1 | |
fi | |
SED_FILE=$1 |
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
m_w = 0x46ab2f73d #must not be zero, nor 0x464fffff | |
m_z = 0xa368bbec #must not be zero, nor 0x9068ffff | |
def mwc(): | |
global m_w | |
global m_z | |
m_z = 36969 * (m_z & 65535) + (m_z >> 16) | |
m_w = 18000 * (m_w & 65535) + (m_w >> 16) | |
return (m_z << 16) + m_w #32-bit result |
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
#!/bin/sh | |
echo "Retrieving all 49 issues of PragPub as epub..." | |
echo "Downloading files to $DIR..." | |
DIR=pragpub | |
mkdir $DIR | |
function getPragPub { |
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
#!/bin/sh | |
bc << EOF | |
scale=4 | |
$@ | |
quit | |
EOF |
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
#!/usr/bin/python | |
#retrieve random Astronomy Picture of the Day | |
#from http://apod.nasa.gov/ | |
import sys | |
import datetime | |
import urllib | |
import urllib2 | |
import random |
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
echo Deploying i2 IAP 3.0.11 example deployment | |
function changeString { | |
if [[ $# -ne 3 ]]; then | |
echo "$FUNCNAME ERROR: Wrong number of arguments. Requires FILE FROMSTRING TOSTRING." | |
return 1 | |
fi | |
SED_FILE=$1 | |
FROMSTRING=$2 |
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
#!/usr/bin/env bash | |
if [[ "$1" != "" ]] ; then | |
cd $1 | |
fi | |
ls -1 | sed "s;^;$(pwd)/;" |
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
#!/usr/bin/env bash | |
#uses clpargs | |
#https://github.com/samisalkosuo/clpargs | |
source $GITDIR/clpargs/clpargs.bash | |
clpargs_program_description "Create iOS app icons from original 1024x1024 icon." | |
#iOS icon sizes | |
#https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html |
OlderNewer