Skip to content

Instantly share code, notes, and snippets.

View scresante's full-sized avatar

scresante

View GitHub Profile
$ git pull origin classify
* branch classify -> FETCH_HEAD
Updating 8e66760..1255dbf
error: The following untracked working tree files would be overwritten by merge:
words
Please move or remove them before you can merge.
Aborting
$ rm words
rm: remove regular file ‘words’? y
$ git pull origin classify
@scresante
scresante / gist:88486d816dd95e62f8a5
Created November 17, 2015 23:32
global gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@scresante
scresante / transformdict.py
Created December 8, 2017 19:32
this is pretty neat
"""Transformdict: a mapping that transforms keys on lookup
This module and ``test_transformdict.py`` were extracted from a
patch contributed to Python by Antoine Pitrou implementing his
PEP 455 -- Adding a key-transforming dictionary to collections.
As of Nov. 14, 2014, the patch was not yet merged to Python 3.5
(which is in pre-alpha). The patch is ``transformdict3.patch``,
part of issue #18986: Add a case-insensitive case-preserving dict.
def runningUniq(anArray, compare=lambda x,y: x==y):
""" non-memory efficient linear deduplicator """
retAr = []
for n, elem in enumerate(anArray):
if n == 0:
last = elem
retAr.append(elem)
continue
if compare(elem, last):
@scresante
scresante / ##-cpx_automount.rules
Last active May 10, 2019 19:23
automount rule for systemd + udev and CPX boards
KERNEL!="sd[a-z][0-9]", GOTO="cpx_by_sn_automount_end"
ATTRS{vendor}=="Adafruit", ENV{vendor}="$attr{vendor}"
ATTRS{serial}=="*", ENV{serial}="$attr{serial}"
#import FS infos
## this imports ID_FS_UUID
IMPORT{program}="/usr/bin/blkid -o udev -p %N"
IMPORT{program}="/bin/sh -c \"/usr/bin/echo serial=%E{serial} | /usr/bin/cut -c1-12\""
# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}-%E{serial}"
ENV{dir_name}=="", ENV{dir_name}="%E{ID_FS_LABEL_FATBOOT}-%E{serial}"
@scresante
scresante / installosc.sh
Created October 7, 2019 04:11
the developer of nfqueue doesn't know what he's doing packaging something like this
#!/bin/sh
cwd=$PWD
# intended use: install oschameleon on centos7
# as root without any bloody care for proper procedures
yum upgrade -y
yum install epel-release -y
yum install wget alien git python-pip gcc -y
pip install gevent
# adapted from https://pypi.org/project/OSfooler-ng/
@scresante
scresante / OTwomen.txt
Created May 23, 2020 03:46
list of OT women
Abi
Abiah
Abigail
Abihail
Abishag
Abital
Achsah
Adah
Ahlai
Aholibamah
@scresante
scresante / gist:e68c849425fd185efad72dfc98f3685b
Created May 30, 2020 04:01
Top 5 2020 AMI providers account IDs
Top 5 2020 AMI providers
"531415883065" openshift
"801119661308" amazon
"979382823631" bitnami
"330183209093" qbol?-hvm
"679593333241" aws-marketplace
import boto3
import secrets
import sys
def create():
user_data = """#!/bin/sh
yum update -y
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y zsh wireguard-tools"""