Skip to content

Instantly share code, notes, and snippets.

View suominen's full-sized avatar

Kimmo Suominen suominen

View GitHub Profile
@toringe
toringe / cidr.py
Created October 22, 2015 10:28
Merge CIDR blocks into super blocks if possible
#!/usr/bin/env python
#
# Example 1: All blocks in list.txt, one CIDR per line
# cat list.txt | cidr.py
#
# Example 2: Echo CIDR blocks to stdout
# echo 1.2.3.0/25 1.2.3.128/25 | cidr.py
import sys
from netaddr import *
@stuartcarnie
stuartcarnie / clear-apc.php
Last active February 25, 2024 11:07
Self-contained php script to clear shared-memory cache in php5-fpm via command-line. In this instance it is clearing APC, but can be easily changed to clear other shared-memory caches.
#!/usr/bin/env php
<?php
/*
Copyright 2013 Stuart Carnie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@jahewson
jahewson / smartos-on-a-budget.sh
Last active March 9, 2024 07:27
Installing and Configuring SmartOS on a budget server (with a /29)
# Licensed under CC BY 3.0 http://creativecommons.org/licenses/by/3.0/
# Derived works must attribute https://gist.github.com/4492300 at the beginning, and the date.
##################################################################
Installing and Configuring SmartOS on a budget server (with a /29)
##################################################################
# if you find this gist useful, please star it
# please be aware that budget hosting companies usually cut corners somewhere,
@neilj
neilj / window-controller.js
Last active November 4, 2022 21:41
Cross-tab window controller
function WindowController () {
this.id = Math.random();
this.isMaster = false;
this.others = {};
window.addEventListener( 'storage', this, false );
window.addEventListener( 'unload', this, false );
this.broadcast( 'hello' );
@robinsmidsrod
robinsmidsrod / _INSTALL.md
Last active March 21, 2024 23:00
Bootstrapping full iPXE native menu with customizable default option with timeout (also includes working Ubuntu 12.04 preseed install)

Add the following chunk to your existing ISC dhcpd.conf file.

if exists user-class and ( option user-class = "iPXE" ) {
    filename "http://boot.smidsrod.lan/boot.ipxe";
}
else {
    filename "undionly.kpxe";
}

(or see https://gist.github.com/4008017 for a more elaborate setup

@chetstone
chetstone / rvm.rb
Created November 12, 2011 21:31
Using rvm with tcsh
#!/usr/bin/env ruby
# riffing on a tune by Paul at po-ru.com
# 1. Using a bash shell, install rvm according to instructions.
# 2. Install this script in your path, say in ~/bin.
# 3. Make it executable.
# 4. Add the following alias to your .tcshrc:
# alias rvm 'eval `~/bin/rvm.rb \!*`'
# 5. Use and enjoy rvm in your tcsh
# Note that this script relies on a ruby already installed in the path.
# It shouldn't be too hard to enhance it to bootstrap itself using rvm.
@kaleb
kaleb / aliases
Created October 15, 2011 15:51
Gmail on Mutt
#~/.mutt/aliases
alias nick Nicholas Levandoski <nick.levandoski@auglug.org>
alias tim Timothy Pitt <timothy.pitt@auglug.org>
alias steven Steven Jackson <sjackson@auglug.org>
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org>
alias alug-admin nick, tim, steven