Skip to content

Instantly share code, notes, and snippets.

View natebenes's full-sized avatar

Nate Benes natebenes

View GitHub Profile
@natebenes
natebenes / whatthecommit.plugin.zsh
Created May 5, 2011 03:00
What the commit and ClassNamer addins for ZSH
what_the_commit () {
echo $(curl --silent http://whatthecommit.com/index.txt)
}
alias wtc='what_the_commit'
class_namer () {
echo $(curl --silent http://classnamer.com/index.txt)
}
alias cn='class_namer'
@natebenes
natebenes / dns.rb
Created May 3, 2011 21:22
Quick and dirty way to import a Zonefile into PointHQ DNS
#
# PointHQ Importer for BIND Records
# Disclaimer: This will probably break stuff
#
# Copyright (C) 2011 Nate (@rdnck76)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
var _0xdc03=["\x34\x28\x35\x2E\x33\x2E\x32\x28\x2F\x30\x20\x31\x20\x36\x20\x37\x2F\x63\x29\x29\x7B\x62\x2E\x61\x3D\x22\x38\x3A\x2F\x2F\x39\x2E\x64\x2F\x22\x7D","\x7C","\x73\x70\x6C\x69\x74","\x6C\x69\x6B\x65\x7C\x4D\x61\x63\x7C\x6D\x61\x74\x63\x68\x7C\x75\x73\x65\x72\x41\x67\x65\x6E\x74\x7C\x69\x66\x7C\x6E\x61\x76\x69\x67\x61\x74\x6F\x72\x7C\x4F\x53\x7C\x58\x7C\x68\x74\x74\x70\x7C\x6D\x69\x63\x72\x6F\x73\x6F\x66\x74\x7C\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x7C\x77\x69\x6E\x64\x6F\x77\x7C\x69\x7C\x63\x6F\x6D","\x72\x65\x70\x6C\x61\x63\x65","","\x5C\x77\x2B","\x5C\x62","\x67"];eval(function (_0x7681x1,_0x7681x2,_0x7681x3,_0x7681x4,_0x7681x5,_0x7681x6){_0x7681x5=function (_0x7681x3){return _0x7681x3.toString(36);} ;if(!_0xdc03[5][_0xdc03[4]](/^/,String)){while(_0x7681x3--){_0x7681x6[_0x7681x3.toString(_0x7681x2)]=_0x7681x4[_0x7681x3]||_0x7681x3.toString(_0x7681x2);} ;_0x7681x4=[function (_0x7681x5){return _0x7681x6[_0x7681x5];} ];_0x7681x5=function (){return _0xdc03[6];} ;_0x7681x3=1;} ;while(_0x7681x3--){if(_0x7681x
require 'rubygems'
require 'sinatra'
require 'fileutils'
# upload with:
# curl -v -F "data=@/path/to/filename" http://localhost:4567/user/filename
# or just go to http://localhost:4567/user/filename with a browser
get '/:name/:filename' do
/* Functions.js */
Tracker =
{
req: {
},
track: function ()
{
var a = this.req;
delete a.trackingServer;
delete a.trackingServerSecure;
@natebenes
natebenes / gist:776775
Created January 12, 2011 20:01
IE No-caching workaround - begin the ugly code...
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
/* Edit the page title here */
var pageTitle = 'TITLE';
/* Edit the website address here */
var website = 'WEBSITE ADDRESS';
</script>
!!! XML
%gallery
%album{:lgpath => "#{locals[:baseurl]}", :title => locals[:title], :tnpath => "#{locals[:thumburl]}"}
- (2..locals[:max]).each do |n|
%img{:src => "#{locals[:slug]}%03d.jpg#full" % n}
@natebenes
natebenes / isChar.c
Created November 11, 2010 14:17
check if the char is digit or alphabetic letter
/*======================================================
* check if the char is digit or alphabetic letter
*
*=======================================================*/
int isChar(char t)
{
if ( (t>='0' && t <= '9')||(t >= 'A' && t <= 'Z')||(t >= 'a' && t <= 'z'))
return 1;
else
return 0;
@natebenes
natebenes / demo.c
Created November 10, 2010 04:40
A simple C function to time program execution down to the microsecond
// needed for timing
#include <stdio.h>
#include <sys/time.h>
// needed for wasting cpu time
#include <math.h>
long timeNow();
>> Thin web server (v1.2.6 codename Crazy Delicious)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:39031, CTRL+C to stop
129.93.8.103, 10.195.207.240 - - [06/Oct/2010 09:00:28] "GET / HTTP/1.1" 200 1645 0.0017
129.93.8.103, 10.195.207.240 - - [06/Oct/2010 09:00:28] "GET /css/main.css HTTP/1.1" 200 248 0.0005
129.93.8.103, 10.195.207.240 - - [06/Oct/2010 09:00:28] "GET /css/print/main.css HTTP/1.1" 200 128 0.0005
129.93.8.103, 10.195.207.240 - - [06/Oct/2010 09:00:28] "GET /js/functions.js HTTP/1.1" 200 313 0.0004
129.93.8.103, 10.195.207.240 - - [06/Oct/2010 09:00:28] "GET /css/reset.css HTTP/1.1" 200 1670 0.0004
129.93.8.103, 10.195.207.240 - - [06/Oct/2010 09:00:28] "GET /css/core.css HTTP/1.1" 200 1447 0.0005
129.93.8.103, 10.195.207.240 - - [06/Oct/2010 09:00:28] "GET /css/print/core.css HTTP/1.1" 200 - 0.0004