Skip to content

Instantly share code, notes, and snippets.

199,-
@mkyed
mkyed / zap-empty-git-branches.bash
Last active November 7, 2022 08:21
Delete git branches that have no difference to master
git branch | grep -v master | while read b; do test 0 -eq `git diff origin/$b $b 2>/dev/null | wc -l` && git branch -D $b; done
@mkyed
mkyed / gist:8a317d24b99c960e2546
Created January 15, 2016 11:18
PowerDNS (pdns) server with mysql backend on Mac OS X El Capitan
brew install pdns
@mkyed
mkyed / dj.rb
Created September 19, 2013 09:41
Look for already existing Delayed::Job
class Delayed::Job
scope :waiting, lambda{where(failed_at: nil).where(locked_at: nil)}
def self.include?(object, method_name = nil, queue = :default)
object_class = object.respond_to?(:id) ? object.class : object
object_id = object.respond_to?(:id) && object.id
waiting.where(queue: queue).detect do |job|
o = job.payload_object.object
m = method_name.present? ? job.payload_object.method_name : nil
o_class = o.respond_to?(:id) ? o.class : o
@mkyed
mkyed / gist:6291891
Created August 21, 2013 08:44
binding.pry app backtrace
caller.select{|c| c =~ /app\/model/}
@mkyed
mkyed / gist:5140564
Created March 12, 2013 05:29
Rebuild Debian 6 amd64 netinst iso to include bnx2 driver
apt-get install wget sudo gzip dpkg genisoimage
mkdir debian-netinst
cd debian-netinst
wget http://cdimage.debian.org/debian-cd/6.0.7/amd64/iso-cd/debian-6.0.7-amd64-netinst.iso
wget http://ftp.dk.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2_0.37_all.deb
mkdir iso
sudo mount -o loop debian-6.0.7-amd64-netinst.iso iso/
mkdir new_iso
cp -av iso/. new_iso/
sudo umount iso
@mkyed
mkyed / gist:1694240
Created January 28, 2012 13:05
Installing PowerDNS 3.0.1 on Mac OS X Lion
1) Install MySQL <http://dev.mysql.com/>
2) Install Homebrew <http://mxcl.github.com/homebrew/>
3) $ brew install boost boost-jam lua pkg-config wget
4) $ wget http://downloads.powerdns.com/releases/pdns-3.0.1.tar.gz && tar xzf pdns-3.0.1.tar.gz
5) $ cd pdns-3.0.1 && ./configure --with-mysql-includes=/usr/local/mysql/include && make && make install
6) Adjust /usr/local/etc/pdns.conf to your mysql setup
7) cat /System/Library/LaunchDaemons/pdns_server.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@mkyed
mkyed / clean-merged-branches
Created January 11, 2012 07:38 — forked from atmos/clean-merged-branches
clean-merged-branches
#!/bin/bash
#
##
## Delete merged Git branches from the origin remote.
##
## Options:
## -f Really delete the branches. Without this branches are shown
## but nothing is deleted.
##