Skip to content

Instantly share code, notes, and snippets.

Cody Kochmann CodyKochmann

Block or report user

Report or block CodyKochmann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@CodyKochmann
CodyKochmann / deb-install-podman.sh
Created Feb 18, 2020
install podman on debian 10 and kali linux
View deb-install-podman.sh
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_10/Release.key -O- | apt-key add -
apt update
apt install podman
@CodyKochmann
CodyKochmann / ramdisk_elasticsearch.sh
Created Feb 18, 2020
ram disk elasticsearch running with zgc
View ramdisk_elasticsearch.sh
# elasticsearch running on ramdisk and zgc
# by: cody kochmann
docker run --name es --cpuset-cpus 0 --memory-swap 0m --memory 4096m --log-driver journald --tmpfs /usr/share/elasticsearch/data --tmpfs /usr/share/elasticsearch/logs -e discovery.type=single-node -p 127.0.0.1:9200:9200 -e ES_JAVA_OPTS="-XX:MaxGCPauseMillis=100 -Xlog:gc: -XX:MinRAMPercentage=10.0 -XX:CMSInitiatingOccupancyFraction=20 -Xmx2048m -Xms2048m -XX:+PrintFlagsFinal -XX:+ClassUnloading -XX:-UsePSAdaptiveSurvivorSizePolicy -XX:+UseStringDeduplication -XX:-UseGCOverheadLimit -XX:-UseSerialGC -XX:-UseConcMarkSweepGC -XX:-UseG1GC -XX:-UseParallelGC -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -XX:-UseThreadPriorities -XX:+UseDynamicNumberOfGCThreads -XX:HeapSizePerGCThread=5452595 -XX:-UseBiasedLocking -XX:-MaxFDLimit -XX:MaxRAMFraction=2 -XX:MaxRAMPercentage=50.0 -XX:+BackgroundCompilation -XX:CICompilerCount=2 -XX:-PrintCompilation -XX:InlineSmallCode=256M -XX:MaxInlineSize=256M -XX:+DisableExplicitGC" -it --rm docker.elastic.co/elasticsea
View linux-install-sublime.sh
#!/bin/bash
# Install sublime text on debian/ubuntu/kali linux
# by: Cody Kochmann
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt install -y apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update
sudo apt install -y sublime-text
@CodyKochmann
CodyKochmann / lossy.py
Created Jan 19, 2020
This script acts as a lossy bash pipe to provide UDP style droppage when its more important to keep up with the latest messages than it is to actually process everything.
View lossy.py
#!/usr/bin/env python3
# by: Cody Kochmann
import fcntl, os, sys
'''
This script acts as a lossy bash pipe to
provide UDP style droppage when its more
important to keep up with the latest messages
than it is to actually process everything.
@CodyKochmann
CodyKochmann / mutually_assured_destruction.py
Last active Jan 13, 2020
This script reads multiple commands from stdin and runs them in parallel. If one of the commands stops, all other commands are killed.
View mutually_assured_destruction.py
import os, sys, shlex, subprocess
'''
This script reads multiple commands from
stdin and runs them in parallel. If one
of the commands stops, all other commands
are killed.
'''
# read in the commands
View dedicated-host-pricing.md

Dedicated Host Pricing

You dont pay for each instances total usage, just flat host cost of the whole host.

Type Description On Demand Host/hr On Demand Host/day 1y host reserv pricing 3y host reserv pricing Instances (Smallest) Instances (Largest)
a1 arm $0.449 $10.78 $2,312 $4,435 a1.medium[16] a1.4xlarge[1]
c4 cpu opt $1.750 $42.00 $9,122 $17,962 c4.large[16] c4.8xlarge[1]
m4 general $2.420 $58.00 $12,257 $23,913 m4.large[22] m4.10xlarge[1]
r3 memory $2.922 $70.13 $13,601 $26,965 r3.
@CodyKochmann
CodyKochmann / mp_print.py
Created Oct 10, 2019
how to print from child processes in python
View mp_print.py
# by: Cody Kochmann
# license: MIT
'''
this demonstrates how to print to stdout of pid1
from child processes in python.
'''
import os
from multiprocessing import Queue
@CodyKochmann
CodyKochmann / sources.list
Created Sep 29, 2019
kali linux default /etc/apt/sources.list
View sources.list
deb https://http.kali.org/kali kali-rolling main contrib non-free
deb-src https://http.kali.org/kali kali-rolling main contrib non-free
View sys_setprofile_example.py
>>> import sys
>>> sys.setprofile(lambda *a, **k: print(a,k))
(<frame object at 0x10b2d9c18>, 'return', None) {}
(<frame object at 0x10b2e4428>, 'call', None) {}
(<frame object at 0x10b2e4428>, 'c_call', <built-in method values of dict object at 0x10bc7cfc0>) {}
(<frame object at 0x10b2e4428>, 'c_return', <built-in method values of dict object at 0x10bc7cfc0>) {}
(<frame object at 0x10b2e4428>, 'return', None) {}
>>> def add(a, b):
... return add(a+1,b) if a % 2 == 1 else a+b
...
@CodyKochmann
CodyKochmann / yieldy_actors.py
Created Aug 29, 2019
Using python generator coroutines as actors
View yieldy_actors.py
#!/usr/bin/env python3
# by: Cody Kochmann
from itertools import cycle
''' this demonstrates how a python generator can be
sent actor style messages via exceptions to delegate
what logic gets applied to each message by taking
advantage of the easy to use mapping try/except trees
already provide '''
You can’t perform that action at this time.