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 / gist:b9da25d4f5ebb0ba2fbd1acc0ed2927c
Created August 29, 2024 05:36
references to old bugs.python.org reports that weren't migrated.
https://bugs.python.org/issue35172 -> https://github.com/python/cpython/issues/79353
https://bugs.python.org/issue35173 -> https://github.com/python/cpython/issues/79354
https://www.plurk.com/p/3g89qh2j4f
@arizvisa
arizvisa / weggli.dc73a25ec28ca42d65517042988fc95076d851e7.patch
Created July 18, 2024 18:16
Patch to weggli-rs/weggli@dc73a25 to add support for spans and bounds to the python module.
From b322ecac9992c8bd8c3dfeaf2579a0b2b4b81336 Mon Sep 17 00:00:00 2001
From: Ali Rizvi-Santiago <arizvisa@gmail.com>
Date: Sat, 28 May 2022 11:49:00 -0500
Subject: [PATCH 1/2] saving my game prior to modifying the tree-sitter-c
grammar
100.0% src/
diff --git a/src/builder.rs b/src/builder.rs
index 13908b0..f600032 100644
@arizvisa
arizvisa / ∕usr∕local∕etc
Last active June 1, 2024 22:17
/usr/local/etc/
$ fuck gh's sorting algorithm and their decision of using the first filename as the gist uri...
@arizvisa
arizvisa / ss-telefrag.py
Created June 21, 2023 19:57
random python code
if __name__ == 'TELEFRAG':
import math, random, ptypes, office.storage
from ptypes import *
source = ptypes.provider.file(rp, 'rw')
source = ptypes.setsource(source)
state = random.Random()
## file
store = office.storage.File()
@arizvisa
arizvisa / internal.interface.py
Created March 5, 2023 07:15
internal.name.typeref for temporary renaming unparsable type declaration.
diff --git a/misc/interface.py b/misc/interface.py
index 4a9504fe5..94b77514b 100644
--- a/misc/interface.py
+++ b/misc/interface.py
@@ -6107,3 +6107,42 @@ class name(object):
logging.fatal(u"{:s}.netnode({:#x}{:s}) : Unable to restore the original name (\"{:s}\") for the netnode at {:#x} which is currently named \"{:s}\".".format('.'.join([__name__, cls.__name__]), identifier, '' if name is None else ", name=\"{:s}\"".format(name), internal.utils.string.escape(original, '"'), identifier, internal.utils.string.escape(temporary, '"')))
logging.info(u"{:s}.netnode({:#x}{:s}) : The original name (\"{:s}\") is currently associated with the netnode at {:#x}.".format('.'.join([__name__, cls.__name__]), identifier, '' if name is None else ", name=\"{:s}\"".format(name), internal.utils.string.escape(original, '"'), internal.netnode.get(original)))
return
+
+ @classmethod
@arizvisa
arizvisa / vcenter-authentication-policies.patch
Last active March 3, 2023 02:20
remove all stupid authentication-related polices from vcenter
--- /dev/null 2023-02-27 00:26:22.135999836 +0000
+++ /etc/pam.d/system-account- 2022-11-08 08:17:09.000000000 +0000
@@ -0,0 +1,7 @@
+# Begin /etc/pam.d/system-account
+# Updated by Ansible - 2022-11-08T08:17:09.196506
+
+account required pam_unix.so
+account required pam_tally2.so deny=3 onerr=fail audit even_deny_root unlock_time=900 root_unlock_time=300
+
+# End /etc/pam.d/system-account
@arizvisa
arizvisa / nested.py
Created February 21, 2023 02:14
modification of nested characters or tokens
def indices(string, characters):
'''Return a generator that yields each index of the given `characters` found in `string`.'''
iterable = (string.find(character) for character in characters)
current, index = 0, min([index for index in iterable if 0 <= index] or [-1])
while 0 <= index:
yield current + index
current, string = current + 1 + index, string[1 + index:]
iterable = [string.find(character) for character in characters]
index = min([index for index in iterable if 0 <= index] or [-1])
return
@arizvisa
arizvisa / blabla.py
Last active February 9, 2024 19:16
shirtz
# gen_key returns privkey as bytes and pem
# load_key will read a key from some bytes (decrypting if a pass is provided), asking user for input, returning privkey as bytes and pem
# gen_certificate takes your private key as bytes and some keywords, returning a cert and pubkey
# load_certificate takes private key and cert as bytes, returning a cert and pubkey
# setup_ssl is just example code how to use those things
def gen_key(e=65537, bits=1024):
import cryptography.hazmat.primitives.asymmetric.rsa as chpar
import cryptography.hazmat.primitives.serialization as chps
import cryptography.hazmat.backends as chb
@arizvisa
arizvisa / multicase.py
Last active December 26, 2022 21:43
constraints with some fixes and some better scoring for performance testing
class multicase(object):
"""
A lot of magic is in this class which allows one to define multiple cases
for a single function.
"""
CO_OPTIMIZED = 0x00001
CO_NEWLOCALS = 0x00002
CO_VARARGS = 0x00004
CO_VARKEYWORDS = 0x00008
CO_NESTED = 0x00010
@arizvisa
arizvisa / ctree-tag-lexer.py
Last active September 14, 2022 21:30
practically useless ctree shiz
F = idaapi.decompile(address)
def ctree_relexer(F, idabits=8 if idaapi.get_inf_structure().is_64bit() else 4):
iterable = (F.pseudocode[i].line for i in range(1 + F.hdrlines, F.pseudocode.size()))
items = ' '.join(iterable).split("\x01({:0{:d}s}".format('', 2 * idabits))
line, = filter(None, items)
for m in re.finditer(r"\x01\(([0-9A-F]{{{:d}}})[\1\2]([^\1\2]+)".format(2 * idabits), line):
id, x = m.groups()
idx = int(id, 0x10)
if F.treeitems.size() <= idx: continue