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
#!/usr/bin/python | |
import sys | |
from optparse import OptionParser | |
import json | |
import urllib | |
def calculate(searchfor): | |
query = urllib.urlencode({'q': searchfor}) | |
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=2.0&%s' % query | |
search_response = urllib.urlopen(url) |
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
try: | |
# For Python 3.0 and later | |
from urllib.request import urlopen | |
except ImportError: | |
# Fall back to Python 2's urllib2 | |
from urllib2 import urlopen | |
import json, argparse, os, sys, pyperclip | |
def get(lib): |
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
fastboot -i 0x2A96 devices | |
fastboot -i 0x2A96 oem unlock | |
fastboot -i 0x2A96 flash boot boot.img | |
fastboot -i 0x2A96 flash aboot emmc_appsboot.mbn | |
fastboot -i 0x2A96 flash modem NON-HLOS.bin | |
fastboot -i 0x2A96 flash rpm rpm.mbn | |
fastboot -i 0x2A96 flash sbl1 sbl1.mbn | |
fastboot -i 0x2A96 flash tz tz.mbn | |
fastboot -i 0x2A96 flash hyp hyp.mbn | |
fastboot -i 0x2A96 flash splash splash.img |
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
#!/usr/bin/env bash | |
# OpenSSL requires the port number. | |
SERVER=yoursslsite.com:443 | |
DELAY=1 | |
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g') | |
echo Obtaining cipher list from $(openssl version). | |
for cipher in ${ciphers[@]} |
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/sh | |
echo "Flush all firewall rules and allowing everyone..." | |
ipt="/sbin/iptables" | |
## Failsafe - die if /sbin/iptables not found | |
[ ! -x "$ipt" ] && { echo "$0: \"${ipt}\" command not found."; exit 1; } | |
$ipt -P INPUT ACCEPT | |
$ipt -P FORWARD ACCEPT | |
$ipt -P OUTPUT ACCEPT | |
$ipt -F | |
$ipt -X |
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 | |
PYFLAKES=$(which pyflakes) | |
GIT=$(which git) | |
BRANCH=$($GIT rev-parse --abbrev-ref HEAD) | |
if [ $# -eq 0 ] | |
then | |
echo "No arguments supplied, please provide atleast 1 branch or commit hash. SYNTAX: difflakes [src] [dst]" | |
exit; |
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
# file: /etc/nginx/sites-available/example.com | |
# nginx configuration for example.com | |
server { | |
listen 80; | |
server_name example.com; | |
access_log /srv/www/example.com/logs/access.log; | |
error_log /srv/www/example.com/logs/error.log; | |
# pass root to django |
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
from datetime import datetime, timedelta, date | |
def get_first_day(dt, d_years=0, d_months=0): | |
# d_years, d_months are "deltas" to apply to dt | |
y, m = dt.year + d_years, dt.month + d_months | |
a, m = divmod(m - 1, 12) | |
dt = date(y + a, m + 1, 1) | |
return datetime(dt.year, dt.month, dt.day, 0, 0, 0) | |
def get_last_day(dt): |
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
import datetime | |
def days_period_to_datetime(dd): | |
now = datetime.datetime.utcnow() | |
return now + datetime.timedelta(days=dd) | |
def months_period_to_datetime(mm): | |
now = datetime.datetime.utcnow() | |
new_day = now.day |
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
## | |
# Set isolation level to READ-COMMITTED | |
# https://dev.mysql.com/doc/refman/5.6/en/set-transaction.html | |
## | |
SELECT @@GLOBAL.tx_isolation, @@tx_isolation; | |
SET GLOBAL tx_isolation='READ-COMMITTED'; | |
SET SESSION tx_isolation='READ-COMMITTED'; | |
## | |
# Set binlog to MIXED format |