Skip to content

Instantly share code, notes, and snippets.

View sudocurse's full-sized avatar
🌮
good screen ? bad screen

sudocurse sudocurse

🌮
good screen ? bad screen
View GitHub Profile
@sudocurse
sudocurse / .pylintrc
Created August 1, 2016 15:38
a pylint config file that i think adheres to the google style guide. may have lifted this from somewhere? ¯\_(ツ)_/¯
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Add files or directories to the blacklist. They should be base names, not
@sudocurse
sudocurse / mesos-apps-flatten.py
Created May 3, 2017 19:34
A script to quickly look at what your app's config looks like with defaults
import json
import sys
import collections
def dict_merge(dictionary, merge_dictionary):
for key, val in merge_dictionary.iteritems():
if (key in dictionary and isinstance(dictionary[key], dict)
and isinstance(merge_dictionary[key], collections.Mapping)):
dict_merge(dictionary[key], merge_dictionary[key])
else:
@sudocurse
sudocurse / osx_syscall_probes.txt
Last active September 11, 2017 03:03
OSX DTrace Probes
# sudo dtrace -lvi "syscall:::" 2>&1 >/dev/null | grep syscall | tr -s " " | cut -d" " -f 4 | uniq > osx_syscall_probes.txt
syscall
exit
fork
read
write
open
close
wait4
#8
@sudocurse
sudocurse / make_user.sh
Created June 26, 2018 17:52
make a user, give them key access
#!/bin/bash
# consume the first argument so we can deal with the key as one variable
username=$1
shift
sudo useradd $username
sudo -u $username mkdir /home/$username/.ssh/
sudo -u $username touch /home/$username/.ssh/authorized_keys
sudo chmod 640 /home/$username/.ssh/authorized_keys
@sudocurse
sudocurse / enable_root.sh
Created June 26, 2018 17:58
sudo access on wheel-supported systems
# add user to the sudo users group
sudo usermod $1 -G wheel
# generate a 16 byte key and print it
key=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1`
echo $key
# set the users password to that key and expire it so they have to change it when they login
sudo sh -c "echo $key | passwd --stdin $1"
sudo passwd -e $1
@sudocurse
sudocurse / sorted
Last active November 22, 2018 22:57
monitor deals
Category Brand+Model Size Price Link
Ultrawide Dell U3417W 34" $645 https://www.amazon.com/Dell-FR3PK-34-Inch-Led-Lit-Monitor/dp/B01IOO4TIM/ref=cm_cr_arp_d_product_top?tag=slickdeals&ascsubtag=6c93cbdeeea411e8af96b213d4e1265c0INT&ie=UTF8
Gaming Asus ROG Swift PG279Q 27" $590 newegg refurb https://slickdeals.net/f/11322175-refurbished-asus-rog-pg279q-g-sync-1440p-gaming-monitor-ips-27-amp-quot-589-99-with-free-free-krazilla-power-bank-w-purchase?src=SiteSearchV2_SearchBarV2Algo1
Ultrawide Acer XR342CK bmijqphuzx 34" $551 https://slickdeals.net/f/11282031-acer-xr2-series-xr342ck-34-quot-ips-1ms-mprt-hdmi-widescreen-led-backlight-lcd-led-monitor-551?src=SiteSearchV2_SearchBarV2Algo1&fbclid=IwAR1U-2gLRMrWI5bwuyCbgr1HXURcRYmjfw2KsuBUVhqR-Tic780FDo2fLXg
4K BenQ PD3200U 32" $51
@sudocurse
sudocurse / jsEventOrder.html
Created March 4, 2019 21:00
javascript event order for an onclick
<html>
<body>
<div id="elem1">
<div id="elem2">
Hi
</div>
</div>
<script>
count = 0;
ha = function(obj){
@sudocurse
sudocurse / fd.py
Last active October 22, 2019 06:58
macos default fd ulimit is 256. why do i see 252?
import tempfile
files = []
while True:
try:
file = tempfile.TemporaryFile()
print("Created file:", file, file.name)
files.append(file)
except OSError:
@sudocurse
sudocurse / proxydhcp.sh
Last active May 12, 2020 12:40
pxe + webproc without fucking up your local dhcp
#!/bin/bash
# Sets up a standalone proxyDHCP server, to PXE netboot, as a container made
# from https://github.com/jpillora/webproc to get a web ui on port 8080 to edit
# conf + monitor logs. You could probably swap out the container and the config
# and most of this script would still be good.
#
# The actual container used is https://hub.docker.com/r/jpillora/dnsmasq
# There's a screenshot on that page.
#
# Notes:
#!/bin/bash
#
# Outputs JSON paths.
#
# Based on https://news.ycombinator.com/item?id=20264654
#
# Usage:
# curl -s https://raw.githubusercontent.com/sitepoint-editors/json-examples/master/src/db.json | ./jsonpaths
jq -r --stream '