Skip to content

Instantly share code, notes, and snippets.

obfuscated = map( lambda x: int(x, 16), "65 65 65 41 03 11 1c 15".split(" "))
original = map( lambda x: int(x, 16), "00 00 00 24 66 74 79 70".split(" "))
print obfuscated
# [101, 101, 101, 65, 3, 17, 28, 21]
print original
# [0, 0, 0, 36, 102, 116, 121, 112]
# Every place we have a 0 in the original, the obfuscated file has 101. Sounds suspicious... ;)
# OK
Note the 'MM' parameter to date_trunc
In [65]: qry ="""
SELECT
trunc(employees.hire_date, 'MM') AS "employees.hire_date_monthly",
coalesce(sum(employees.salary), 0) AS "employees.salary_sum"
FROM
employees JOIN departments ON employees.department_id = departments.department_id
@labeneator
labeneator / confirm.xml
Last active March 16, 2017 13:43
1. Save confirm xml somewhere
<?xml version="1.0" encoding="utf-8" ?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:C2BPaymentConfirmationRequest xmlns:ns1="http://cps.huawei.com/cpsinterface/c2bpayment"><TransType>PayBill</TransType><TransID>12655422469971</TransID><TransTime>20140227082020</TransTime><TransAmount>123.00</TransAmount><BusinessShortCode>777126</BusinessShortCode><BillRefNumber>TX1001</BillRefNumber><InvoiceNumber>X334343</InvoiceNumber><OrgAccountBalance>12345.00</OrgAccountBalance><ThirdPartyTransID>1234560000088888</ThirdPartyTransID><MSISDN>0722703615</MSISDN><KYCInfo><KYCName>[Personal Details][First Name]</KYCName><KYCValue>Hoiyor</KYCValue></KYCInfo><KYCInfo><KYCName>[Personal Details][Middle Name]</KYCName><KYCValue>G</KYCValue></KYCInfo><KYCInfo><KYCName>[Personal Details][Last Name]</KYCName><KYCValue>Chen</KYCValue></KYCInfo></ns1:C2BPaymentConfirmationRequest></soapenv:Body></soapenv:Envelope>
@labeneator
labeneator / gist:b5c7ee96192d3e4be61c
Created October 2, 2015 07:17
curling el_capitan || How do grab the pkg from Apple's CDN servers
1. Locate the storedownload process
ps aux |grep storedown
user 494 12.3 0.2 3597016 19724 ?? S 21Sep15 31:14.11 /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/storedownloadd
2. Attach dtruss to the storedownloader process
sudo dtruss -p 494 2>&1 | tee storedownload
3. Start the download on the appstore application
4. Inspect the storedownload process using lsof to figure out the remote endpoints
@labeneator
labeneator / xpilot-server_clang_return_bool.patch
Last active August 29, 2015 14:08
Patch to enable xpilot to build on osx
diff --git a/src/server/suibotdef.c b/src/server/suibotdef.c
index 494f73f..d5202e3 100644
--- a/src/server/suibotdef.c
+++ b/src/server/suibotdef.c
@@ -405,7 +405,7 @@ static bool Get_object_proximity(player_t *pl, object_t *shot, double sqmaxdist,
/* ignore if there is enough time to deal with this object later */
if((time_until_closest < 0) || (time_until_closest > maxtime))
/*option instead of fixed value: options.dodgetime))*/
+ return false;
- return;
@labeneator
labeneator / .zshrc
Last active August 29, 2015 14:08
.zshrc
#
# Executes commands at the start of an interactive session.
#
# Authors:
# Sorin Ionescu <[email protected]>
#
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
@labeneator
labeneator / debianise_and_build_a_venv_package.sh
Created July 22, 2014 09:20
How to generate and build a .deb package for python virtualenv projects
#!/bin/sh
# Variables
PKG_NAME=SomeCompany-python-api
PKG_VERSION=0.1
[email protected]
export DEBFULLNAME="Laban Mwangi"
PKG_NAME_VERSION=${PKG_NAME}-${PKG_VERSION}
PKG_SCRIPT_NAME=$(echo $PKG_NAME | sed -e "s/-/_/g")
@labeneator
labeneator / process_start.out
Created July 8, 2014 12:01
Processes pids and lock acquisition status
Starting process 1
Starting process 2
Starting process 3
Starting process 4
Starting process 5
@labeneator
labeneator / lsof.output
Created July 8, 2014 12:01
File locking status according to lsof
Tue Jul 8 11:51:18 UTC 2014
Tue Jul 8 11:51:20 UTC 2014
Tue Jul 8 11:51:22 UTC 2014
Tue Jul 8 11:51:24 UTC 2014
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python 822 vagrant 3w REG 254,0 0 1973047 /tmp/some_lock_file
python 823 vagrant 3w REG 254,0 0 1973047 /tmp/some_lock_file
@labeneator
labeneator / flock.py
Last active August 29, 2015 14:03
A file locker that uses the context manager.
import fcntl
class FileLock:
def __init__(self, filename, lock_type):
self.fh = open(filename, "a")
self.lock_type = lock_type
def __enter__(self):
print "Acquiring lock"