Skip to content

Instantly share code, notes, and snippets.

@tekin
tekin / .gitattributes
Last active July 9, 2024 20:31
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp
@jtimberman
jtimberman / cbfrozen.rb
Last active February 5, 2020 18:31
displays whether cookbooks are frozen on the chef server for a given version. put this in ~/.chef/plugins/knife.
#
# Author: Joshua Timberman <joshua@opscode.com>
# Copyright (c) 2013, Opscode, Inc <legal@opscode.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@anowell
anowell / git-ship
Last active May 29, 2020 07:32
A git script to accommodate my workflow of merging (or rebasing) a particular feature branch into master: pull master, optionally rebase the feature branch, merge back to master, push, and finally remove branch.
#!/bin/sh
#
# My workflow:
# git checkout -b myfeature
# ...edit stuff...git commit...edit stuff...git commit...ready to ship...
# git ship myfeature -rpd
#
# It exits if the merge or rebase requires intervention,
# for merge: fix the conflict, commit the merge, and re-run the git ship command
# for rebase: clean up the conflict, run `git rebase --continue` and then re-run the git ship command
@joemiller
joemiller / pantheon-check-ping-endpionts.rb
Created June 18, 2013 15:56
a meta-check for sensu that creates many other checks
#!/usr/bin/env ruby
#
# this is a special meta-check. It runs ping checks against all hosts in
# the /endpoints API and sends individual results directly to sensu-client via
# the udp/3030 client socket. this is different from the normal sensu check model
# where individual scripts run and their exit status and output is used to create
# a single event.
#
# the reason for this check is to be able to dynamically ping a list of hosts
# without the race conditions and timing issues involved with creating individual
UBUNTU_NAME='precise'
UBUNTU_VERSION='12.04'
CHEF_VERSION='10.26.0'
ARCH='amd64'
sudo debootstrap --arch=${ARCH} --variant=minbase ${UBUNTU_NAME} ${UBUNTU_NAME}-${BUILD_NUMBER}
snapshot0=$(sudo tar -C ${UBUNTU_NAME}-${BUILD_NUMBER} -c .|docker import -)
sudo rm -rf ${UBUNTU_NAME}-${BUILD_NUMBER}
cat > Dockerfile <<EOF
FROM ${snapshot0}
@UnwashedMeme
UnwashedMeme / automount-swaps.conf
Last active December 14, 2015 04:59
Upstart task to scan for and activate any block devices with type swap; based on blkid.
# automount-swaps scans for any block devices with type swap (as
# identified by blkid) and activates them with swapon.
#
description "Automount swap devices"
start on all-swaps #generated by mountall
task
@mm53bar
mm53bar / Gemfile
Created January 30, 2013 15:37
Be sure to install the datadog agent on your server before applying this code to your app. Instructions are at https://app.datadoghq.com/account/settings#agent or use my Sunzi recipe at https://github.com/Shift81/sunzi-recipes/blob/master/ubuntu/precise/datadog.sh
gem 'dogstatsd-ruby'
@robinsmidsrod
robinsmidsrod / dhcpd.conf
Last active June 11, 2024 13:10
Trying to chainload iPXE with full feature set from a lesser featured one, whilst still being able to boot non-supported cards with UNDI
ddns-update-style none;
deny bootp; #default
authoritative;
include "/etc/dhcp/ipxe-option-space.conf";
# GREEN (private network)
subnet 10.1.1.0 netmask 255.255.255.0 {
range 10.1.1.100 10.1.1.199;
option subnet-mask 255.255.255.0;
@robinsmidsrod
robinsmidsrod / _README.md
Last active May 11, 2024 00:20
Embedded iPXE menu to choose which network adapter to boot from (autodetects up to 10 adapters)

Go into your git checkout folder of ipxe.

Save the below file as nic-menu.ipxe.

Build iPXE like this:

cd src && make EMBED=../nic-menu.ipxe && cd ..

Requirements: current iPXE as of 2013-08-01 (for proper behavior of autoboot with a network device specified, netX feature, PCI vendor/device ID display and inc command)

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: