Skip to content

Instantly share code, notes, and snippets.

@matthewd
matthewd / diff-configs.sh
Created September 30, 2011 19:48
Diff /etc files against the versions supplied in Debian packages
#!/bin/bash
# This script will make a best-effort attempt at showing modifications
# to package-provided config files on a Debian system.
#
# It's subject to some pretty significant limitations: most notably,
# there's no way to identify all such config files. We approximate the
# answer by looking first at dpkg-managed conffiles, and then hoping
# that most of the time, if maintainer scripts are managing files
# themselves, they're using ucf. So, DO NOT TRUST THIS SCRIPT to find
@alexras
alexras / ssh-agent-snippets.sh
Created October 17, 2011 00:14
Bash snippets to automatically start and stop an ssh-agent process on login and logout
#!/bin/bash
## in .bash_profile
SSHAGENT=`which ssh-agent`
SSHAGENTARGS="-s"
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
eval `$SSHAGENT $SSHAGENTARGS`
trap "kill $SSH_AGENT_PID" 0
fi
@hay
hay / gist:1351230
Last active March 29, 2024 16:36
Enterprisify your Java Class Names!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Enterprisify your Java Class Names! (by Hay Kranen)</title>
<style>
body {
background: white;
text-align: center;
@cmalven
cmalven / index.html
Last active April 27, 2024 10:17
Shortest (useful) HTML5 Document
<!-- http://www.brucelawson.co.uk/2010/a-minimal-html5-document/ -->
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>blah</title>
</head>
<body>
<p>I'm the content</p>
@tomdale
tomdale / gist:2494968
Created April 26, 2012 01:10
Ember.js View Context Change

View Context Changes

The rules for how Ember.js evaluates Handlebars templates have recently changed, and you may need to update your application's templates to ensure they continue working..

Template Contexts

Remember that a template is always evaluated against a context object. When you render a template, values are looked up from that object. For example:

Hello, {{firstName}} {{lastName}}!
@dsc
dsc / jconsole-proxy.sh
Created August 7, 2012 01:15
jconsole via ssh proxy
#!/bin/bash
#/ jc -- jconsole via ssh proxy
#/
#/ Usage: jc [options] HOST JMX_PORT [PROXY_PORT=JMX_PORT] [JMX_HOST=HOST]
#/
#/ Starts a SOCKS proxy via ssh to connect to a
#/ JVM running on a remote and protected machine.
#/
#/ Arguments:
@seandenigris
seandenigris / install_debian.sh
Last active February 11, 2024 01:31
VirtualBox: Programmatically Create Debian VM
#!/bin/bash
# Reference: http://stdioe.blogspot.com/2012/01/creating-virtual-machine-with.html
VM_NAME="Debian Squeeze 2"
DEBIAN_CD_IMAGE="debian-6.0.7-amd64-netinst.iso"
# Create VM
VBoxManage createvm --name "$VM_NAME" --ostype Debian_64 --register
# VM Settings
@jelies
jelies / AutowiringSpringBeanJobFactory.java
Last active January 24, 2024 10:43
Quartz (2.1.6) java config with spring (3.2.1). Using a SpringBeanJobFactory to automatically autowire quartz classes.
package com.jelies.spring3tomcat7.config.quartz;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
/**
* This JobFactory autowires automatically the created quartz bean with spring @Autowired dependencies.
@fabaff
fabaff / gist:5489197
Created April 30, 2013 14:46
systemd service unit for node.js http-server
[Unit]
Description=A simple node.js Web server
After=network.target
[Service]
Type=simple
User=nobody
Group=nobody
Restart=always
ExecStart=/usr/bin/http-server /var/www/nodejs -p 8888 -s
@runekaagaard
runekaagaard / pgx.rst
Last active September 18, 2018 14:09
Bash scripts for extracting individual databases from a sql file dumped using pg_dumpall

Postgresql Xtra commands

  • pgx_list_dbs: Lists the names of databases in an .sql file dumped using pg_dumpall.
  • pgx_extract_db: Extracts a single database from a sql file dumped with pg_dumpall and outputs its content to stdout.

Installation