Skip to content

Instantly share code, notes, and snippets.

View hh's full-sized avatar

Hippie Hacker hh

View GitHub Profile
@spikegrobstein
spikegrobstein / chef_compact.sh
Created November 16, 2012 23:39
Chef compaction script run via cron
#! /bin/bash -
curl -H "Content-Type: application/json" localhost:5984/chef
curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact
sleep 3
for VIEW in nodes roles registrations clients data_bags data_bags_items users checksums cookbooks sandboxes environments id_map; do
curl -H "Content-Type: application/json" -X POST http://localhost:5984/chef/_compact/$VIEW
anonymous
anonymous / Firefox Default SSL CAs.mkd
Created January 2, 2013 17:24
Is there a way to change the default SSL CA's for firefox BEFORE the profile is created on Ubuntu?
user@laptop:~$ lsb_release  -a
No LSB modules are available.
Distributor ID:  Ubuntu
Description:	Ubuntu 12.04.1 LTS
Release:	12.04
Codename:	precise

user@laptop:~$ certutil -d ~/.mozilla/firefox/fk9tyf55.default -L
#!./bin/knife exec
# A knife exec script to change chef node's name, preserving all the attributes.
#
# Usage: knife exec rename-node.rb old-name new-name
#
# Script retrieves the Node object, changes its 'name' attribute,
# creates new Node object with updated name and rest of attributes
# untouched. Then it deletes old Node and Client objects from
# database, and logs into the server to update it:
@SlexAxton
SlexAxton / .zshrc
Last active March 24, 2025 17:35
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@jpetazzo
jpetazzo / README.md
Last active September 30, 2022 05:36
Share a directory with a docker container

Rectifier

The diode bridge is the simplest rectifier I know.

Rectifier lets you share a directory with a docker container (just like $yourvm shared folders).

You don't have to install anything in your containers, and you only need to install diod in the host. diod is packaged on Ubuntu/Debian distros, and will automatically be apt-get install-ed if needed.

Since it uses diod to make a bridge, I called it rectifier. Yeah, that sucks, so if you have a better name, I'll steal it!

@chrisbarrett
chrisbarrett / Learn Emacs in 7 days.el
Last active February 9, 2020 06:13
Paste into the scratch buffer and `M-x eval-buffer` to begin the journey.
(url-copy-file "http://ulrichdesign.ca/wp-content/uploads/2011/11/YOU-LACK-discipline.jpg"
"~/discipline.jpg")
(defun you-lack-discipline ()
(interactive)
(insert-image (create-image "~/discipline.jpg")))
(dolist (k '([up] [left] [down] [right]))
(global-set-key k 'you-lack-discipline))
@aras-p
aras-p / preprocessor_fun.h
Last active May 3, 2025 13:47
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
# Windows AMIs don't have WinRM enabled by default -- this script will enable WinRM
# AND install 7-zip, curl and .NET 4 if its missing.
# Then use the EC2 tools to create a new AMI from the result, and you have a system
# that will execute user-data as a PowerShell script after the instance fires up!
# This has been tested on Windows 2008 SP2 64bits AMIs provided by Amazon
#
# Inject this as user-data of a Windows 2008 AMI, like this (edit the adminPassword to your needs):
#
# <powershell>
# Set-ExecutionPolicy Unrestricted
@kylemanna
kylemanna / connmanctl.md
Last active June 27, 2023 23:12
Connmanctl Cheat Sheet
@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet