Skip to content

Instantly share code, notes, and snippets.

import argparse
import glob
import plistlib
import re
from os import path, mkdir
import yaml
'''
@prologic
prologic / LearnGoIn5mins.md
Last active July 3, 2024 04:05
Learn Go in ~5mins
@mturilin
mturilin / convert.py
Created January 26, 2020 07:44
Converst TextExpander csv to espanso yaml
#!/usr/bin/python3
import yaml
import sys
import csv
# create root yaml
matches = []
# open file
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@kjaymiller
kjaymiller / text_to_things3.scptd
Last active October 7, 2021 22:24
AppleScript Import Text to Things3
on run {input, parameters}
set delimitedList to paragraphs of (input as string)
tell application "Things3"
repeat with currentTodo in reverse of delimitedList
set newToDo to make new to do with properties {name:currentTodo} at beginning of list "Inbox"
end repeat
end tell
end run
@simonw
simonw / recover_source_code.md
Last active June 21, 2024 00:11
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
Facter.add(:service_provider) do
setcode do
Puppet::Type.type(:service).newservice(:name => 'anyservice')[:provider].to_s
end
end
@bahamas10
bahamas10 / 0-README.md
Last active January 4, 2019 18:02
Joyent Manta Functions
#! /bin/bash
CACERT='/etc/puppetlabs/puppet/ssl/certs/ca.pem'
CERT='/opt/puppet/share/puppet-dashboard/certs/pe-internal-dashboard.cert.pem'
KEY='/opt/puppet/share/puppet-dashboard/certs/pe-internal-dashboard.private_key.pem'
HOST=$(hostname -f)
URL='production/resource/node'
curl --cacert ${CACERT} --cert ${CERT} --key ${KEY} "https://${HOST}:8140/${URL}"
@ddbeck
ddbeck / toggleDistractions.js.scpt
Last active August 29, 2015 14:22
A script to toggle distractions from Mac OS X Dock badges
// Use this Mac OS X automation script to quickly hide notifications for
// distracting apps. Put the names of the distracting apps in the
// `distractingApps` array and save the script. Run the script to toggle the
// badges on and off.
// Tip: To run this script much faster, move the distracting apps to the top of
// the list in System Preferences's Notifications pane.
var distractingApps = ['Tweetbot', 'Slack']