Skip to content

Instantly share code, notes, and snippets.

View arizvisa's full-sized avatar
🖕

Ali Rizvi-Santiago arizvisa

🖕
  • Everything here is BSD Licensed unless specified otherwise.
View GitHub Profile
@arizvisa
arizvisa / .vimrc
Created July 31, 2015 04:07
auto-loading/saving a session to .vim.session
""" session auto-saving and things
"set sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize
if has("unix") || &shellslash | let s:pathsep = '/' | else | let s:pathsep = '\' | endif
let g:session_file = join([getcwd(),".vim.session"], s:pathsep)
if (argc() == 0) && empty(v:this_session) && filereadable(g:session_file)
let g:session = 1
else
let g:session = 0
endif
@arizvisa
arizvisa / wrapper.py
Last active January 6, 2019 05:52
(Python2) properly wrapping a callable whilst retaining all information about the wrappee
import functools,operator,itertools,types,six
class wrap(object):
"""
A lot of magic is in this class which allows one to do a proper wrap
around a single callable.
"""
CO_OPTIMIZED = 0x00001
CO_NEWLOCALS = 0x00002
@arizvisa
arizvisa / user-prefs.js
Last active July 18, 2022 18:20
Firefox anti-networking/privacy/fuzzing preferences
// crash recovery
user_pref("toolkit.startup.recent_crashes", "");
user_pref("browser.sessionstore.resume_from_crash", false);
// browser settings
user_pref("browser.startup.homepage", "about:blank");
user_pref("browser.newtabpage.enabled", false);
// browser notifications
user_pref("general.warnOnAboutConfig", false);
@arizvisa
arizvisa / lamegraph.sh
Created March 28, 2019 16:58
Generate a dependency graph for a bunch of PE (*.dll and *.exe) files linking imports to dlls and exports
(
echo 'digraph lamegraph {'
find . -name '*.exe' -type f -o -name '*.dll' -type f | while read fn; do
sn=$( basename "$fn" )
python $SYRINGE/tools/pe.py -Olist -e "$fn" | tr -d $'\r' | cut -d: -f3 | while read e; do
printf '"%s" -> "%s!%s";\n' "$sn" "$sn" "$e"
break
done
python $SYRINGE/tools/pe.py -Olist -i "$fn" | while IFS=: read i module; do
wtf=`echo -n "$module" | tr -d $'\r'`
1000 exit
1001 cd work/salt/
1002 ls
1003 git branch
1004 git log
1005 git fetch
1006 git show 43f9a0
1007 cd requirements/
1008 ls
1009 l base.txt
@arizvisa
arizvisa / subprocess-spawn.py
Last active May 4, 2020 20:19
Running a sub-process asynchronously and receiving a callback when any output is ready
########################################################################
# Wrappers if you want to use gevent for light-weight threading #
########################################################################
try:
if 'gevent' not in sys.modules:
raise ImportError
import gevent
# wrapper around greenlet since my instance of gevent.threading doesn't include a Thread class for some reason.
@arizvisa
arizvisa / memoize.py
Last active May 4, 2020 20:38
python memoization decorator
'''
Example:
# Memoize result from `myfunction1` depending on the arg1 and arg3 parameters.
@memoize('arg1', 'arg3')
def myfunction1(arg1, arg2, arg3):
...
res = myfunction1('key1', 'meh', 7)
# Memoize result from `myfunction2` depending on 'prop' attribute from "argobject" parameter.
This file has been truncated, but you can view the full file.
=== Logging started: 6/10/2020 17:09:01 ===
Action 17:09:01: INSTALL.
Action start 17:09:01: INSTALL.
Action 17:09:01: SystemFolder_x86_VC.41084701_5F61_3497_AC5D_D0A6D4A85536.
Action start 17:09:01: SystemFolder_x86_VC.41084701_5F61_3497_AC5D_D0A6D4A85536.
Action ended 17:09:01: SystemFolder_x86_VC.41084701_5F61_3497_AC5D_D0A6D4A85536. Return value 1.
Action 17:09:01: SystemFolder.41084701_5F61_3497_AC5D_D0A6D4A85536.
Action start 17:09:01: SystemFolder.41084701_5F61_3497_AC5D_D0A6D4A85536.
Action ended 17:09:01: SystemFolder.41084701_5F61_3497_AC5D_D0A6D4A85536. Return value 1.
Action 17:09:01: SystemFolder_x86_VC.194841A2_D0F2_3B96_9F71_05BA91BEA0FA.
@arizvisa
arizvisa / dd_vcredist_x86_20200610171145.log
Created June 10, 2020 22:43
Salt-Minion-3001rc1-Py3-x86-Setup.exe.log
[0B04:0B0C][2020-06-10T17:11:45]i001: Burn v3.7.3424.0, Windows v6.3 (Build 9600: Service Pack 0), path: C:\Users\root\AppData\Local\Temp\nsr6DE.tmp\vcredist_x86_2013.exe, cmdline: '/install /quiet /norestart -burn.unelevated BurnPipe.{465D8657-5FD5-4436-9E60-3780B4270052} {4DB24AA4-92B3-45A3-984B-77F9450AF437} 2304'
[0B04:0B0C][2020-06-10T17:11:45]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\root\AppData\Local\Temp\dd_vcredist_x86_20200610171145.log'
[0B04:0B0C][2020-06-10T17:11:45]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\root\AppData\Local\Temp\nsr6DE.tmp\vcredist_x86_2013.exe'
[0B04:0B0C][2020-06-10T17:11:45]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'C:\Users\root\AppData\Local\Temp\nsr6DE.tmp\'
[0B04:0B0C][2020-06-10T17:11:45]i000: Setting string variable 'WixBundleName' to value 'Microsoft Visual C++ 2013 Redistributable (x86) - 12.0.40664'
[0B04:0B0C][2020-06-10T17:11:45]i100: Detect begin, 2 packages
[0B04:0B0C][2020-06-1
@arizvisa
arizvisa / developer-console-extensions.js
Created September 23, 2020 18:23
Developer Console Extensions (greasemonkey)
// ==UserScript==
// @name Developer Console Extensions
// @description This adds a number of utilities to the developer console object
// @version 1
// @noframes
// @run-at document-end
// @grant none
// ==/UserScript==
/*