Skip to content

Instantly share code, notes, and snippets.

@NatElkins
NatElkins / cloud-init.yaml
Created March 8, 2025 22:09
cloud-init script for VPS
#cloud-config
# Enable automatic package updates and upgrades during cloud-init execution
package_update: true
package_upgrade: true
packages:
# Security and Hardening
- ufw
- fail2ban
@tekin
tekin / .gitattributes
Last active July 2, 2025 17:00
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 <[email protected]>
# Copyright (c) 2013, Opscode, Inc <[email protected]>
#
# 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 April 9, 2025 20:20
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;