Skip to content

Instantly share code, notes, and snippets.

@chanchalg
chanchalg / pom.xml
Created January 17, 2013 19:38 — forked from codahale/pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- none yet -->
def r(this)
require this
puts "#{this} is now loaded."
rescue LoadError
puts "The gem '#{this}' is missing."
puts "Should I install it? [y/n]"
if gets =~ /yes|y/i
puts "Installing #{this}, hold on."
if `gem install #{this}` =~ /Successfully/
Gem.clear_paths
@chanchalg
chanchalg / rss-subscribers.sh
Created September 25, 2012 22:44
Bash script to parse Apache log for a count of RSS subscribers and email it to you
#!/bin/bash
# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.
# Required variables:
RSS_URI="/rss"
MAIL_TO="[email protected]"
LOG_FILE="/var/log/httpd/access_log"
@chanchalg
chanchalg / LICENSE.txt
Created August 14, 2012 07:10 — forked from atesgoral/LICENSE.txt
Variable-argument string formatter with {token} syntax that supports object properties and argument indices
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Ates Goral <http://magnetiq.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@chanchalg
chanchalg / new_bashrc.sh
Created August 11, 2012 07:41 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
Robot r = new Robot();
System.out.println("Start!");
Thread.sleep(2000); // give yourself some margin to switch window
int[] times = { 1, 5, 4, 4, 1, 3, 2 }; // number of shots for each distance
int[] delays = { 400, 400, 575, 820, 850, 1150, 1350 }; // time holding the ball
int[] delays2 = { 200, 650, 700, 600, 400, 450, 400 }; // time waiting for a new ball
for (int i = 0; i < times.length; i++)
for (int j = 0; j < times[i]; j++) {
r.keyPress(KeyEvent.VK_SPACE);
r.delay(delays[i]);
@chanchalg
chanchalg / conf.apache
Created July 12, 2012 19:57 — forked from vjt/conf.apache
GRC (Generic Colouriser/Colorizer) configuration for Apache / nginx access logs
# Configuration suitable to display Apache/nginx access logs
# Based on conf.proftpd by Pavol Domin
# Crafted by Marcello Barnaba <[email protected]>
# Get GRC at http://kassiopeia.juls.savba.sk/~garabik/software/grc.html
#
# ip number
regexp=^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
colours=bold magenta
@chanchalg
chanchalg / conf.nmap
Created July 12, 2012 19:50 — forked from sygo/conf.hexdump
additions to the standard grc.conf (check the appropriate conf files for each command)
# ip number
regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}
colours=bold yellow
======
# list header
regexp=(PORT|STATE|SERVICE|REASON|VERSION)
colours=bold white
======
# open
regexp=open
@chanchalg
chanchalg / table.html
Created July 11, 2012 02:30 — forked from dunhamsteve/table.html
Example of a scrollable table that only renders visible rows
<html>
<style type="text/css" media="screen">
#table {
position: absolute;
top: 30px;
bottom: 0;
left: 10px;
right: 10px;
}
#header {
@chanchalg
chanchalg / Google Closure.sublime-build
Created February 17, 2012 21:42 — forked from insin/Google Closure.sublime-build (Linux)
Google Closure Compiler build for Sublime Text 2
{
"cmd": ["java", "-jar", "${packages}/Google Closure/compiler.jar", "--js", "$file", "--js_output_file", "/dev/null", "--compilation_level", "WHITESPACE_ONLY"],
"file_regex": "^(.*):([0-9]+):() ERROR - (.*)",
"selector": "source.js"
}