Skip to content

Instantly share code, notes, and snippets.

View rdammkoehler's full-sized avatar

Rich Dammkoehler rdammkoehler

View GitHub Profile
@rdammkoehler
rdammkoehler / timed_decorator.py
Created October 10, 2024 20:10
Python Timing Decorator (simple)
import logging
from datetime import datetime
import time
def timed(method):
def _timed(*args, **kwargs):
start_time = time.time()
result = method(*args, **kwargs)
end_time = time.time()
@rdammkoehler
rdammkoehler / monk.cow
Last active August 3, 2023 16:19
A Monk for cowsay
$the_cow = <<EOC;
$thoughts _=_
$thoughts q(-_-)p
$thoughts '_) (_`
/__/ \\
_(<_ / )_
(__\\_\\_|_/__)
EOC
# this might be a comment
@rdammkoehler
rdammkoehler / validateWithExceptions.js
Created January 20, 2023 06:17
Example Validation using Exceptions
function validate(httpReq) {
const body = JSON.parse(httpReq.body);
if (!body.hasOwnProperty('name')) {
throw new Error('invalid request');
}
}
@rdammkoehler
rdammkoehler / kill_zoom_server.sh
Created July 9, 2019 18:41
Mac Users: Kill the Zoom.us server running on your machine and disable it permanently in one line!
# for details see this article
# https://medium.com/@jonathan.leitschuh/zoom-zero-day-4-million-webcams-maybe-an-rce-just-get-them-to-visit-your-website-ac75c83f4ef5
lsof -i :19421 | tail -1 | awk '{print $2}' | xargs -I {} kill -9 {} && rm -Rf ~/.zoomus && touch ~/.zoomus
@rdammkoehler
rdammkoehler / copy_iso_to_usb.sh
Created April 21, 2016 20:25
Copy an ISO to a USB stick with a progress bar (linux/mac)
# with a progress bar
dd if=/Users/rich/Downloads/kali-linux-2016.1-amd64.iso | pv | dd of=/dev/disk2 bs=1m
pair = :you
pear = :fruit
join = :happy
pair
pair
pair
pear
pair
pair
pair
### Keybase proof
I hereby claim:
* I am rdammkoehler on github.
* I am individualrich (https://keybase.io/individualrich) on keybase.
* I have a public key ASA7Htyss5Qw0rmd4M7KRRl-Bhlrtlbp8vc4FFm26bCdQQo
To claim this, I am signing this object:
@rdammkoehler
rdammkoehler / .gitconfig
Last active June 8, 2018 15:08
My .gitconfig
[user]
name = Rich Dammkoehler
email = rpd@noradltd.com
[color]
branch = auto
diff = auto
status = auto
showbranch = auto
[alias]
b = branch
@rdammkoehler
rdammkoehler / find_largest.sh
Last active April 16, 2018 22:09
Find the Largest Files on your Disk
sudo du -kx 2>/dev/null | sort -nr > /tmp/du-k.sort
@rdammkoehler
rdammkoehler / update_slack.sh
Last active April 10, 2018 14:08
Update Slack with my iTunes Track
#!/bin/bash
state=`osascript -e 'tell application "iTunes" to player state as string'`
if [ $state == 'playing' ];
then
artist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
track=`osascript -e 'tell application "iTunes" to name of current track as string'`
message="$USER is listening to $track by $artist"