Skip to content

Instantly share code, notes, and snippets.

View denzuko's full-sized avatar
💬
twitter.com/denzuko

Dwight Spencer (denzuko@mastodon.social) denzuko

💬
twitter.com/denzuko
View GitHub Profile
require 'sinatra/base'
run Sinatra.new {
get('/') do
content_type "text/plain" # you can also use Rack::ContentType
# with Sinatra except here we want
# more control since Sinatra gives it
# to us. Rack::ContentType sets the
# Content-Type on every route/url for
# the current mapping.
alias dewip="sed -E -i '' -e '/^[[:blank:]]*@wip$/d;s/,[[:blank:]]*@wip//g;s/@wip,[[:blank:]]*//g' features/**/*.feature"
@justjkk
justjkk / LICENSE
Last active April 7, 2024 16:57
Parsing JSON with lex and yacc
The MIT License (MIT)
Copyright (c) 2015 J Kishore Kumar
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 permit persons to whom the Software is
furnished to do so, subject to the following conditions:
var z="http://gist.github.com/",y=document.write,x=$("body"),w=$("p.gist").map(function(b,a){a=$(a);var c=$("a",a),u=c.attr("href");if(c.length&&u.indexOf(z)==0)return{p:a,id:u.substring(z.length)}}).get(),v=function(){if(w.length==0)document.write=y;else{var b=w.shift();document.write=function(){document.write=function(a){b.p.replaceWith(a);v()}};x.append('<scr'+'ipt src="'+z+b.id+'.js"></scr'+'ipt>')}};v();
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
require 'rubygems'
require 'rack'
class Object
def webapp
class << self
define_method :call do |env|
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func, *attrs)]
end
#!/usr/bin/env ruby
puts "lat\tlon\ttitle\tdescription\ticon\ticonSize\ticonOffset\n"
coordinates = File.readlines "ictf-coordinates.txt"
coordinates.map! { |co| co.chomp.split(',')[1].split(';') }
organisations = File.readlines "ictf-participants.txt"
organisations.map! { |o| o.chomp }
teamnames = File.readlines "ictf-teamnames.txt"
teamnames.map! { |t| t.chomp }
# Most of this was adapted from
# http://matt.might.net/articles/compiling-up-to-lambda-calculus/
# Python's lambda expressions are turing-complete. To show this, we will
# implement the "Lambda calculus" which is another way of saying "We're so manly
# we don't even NEED if statements!" The lambda calculus was invented in the
# 1930s, and it can solve any computable problem just by using anonymous
# functions that each take one argument and return one value, function
# application, and variable references. No jumps or GO TO's needed.
@reyjrar
reyjrar / kerberos.pm
Created March 23, 2011 19:18
PacketFence authentication::kerberos
package authentication::kerberos;
=head1 NAME
authentication::kerberos - kerberos authentication
=head1 SYNOPSYS
use authentication::kerberos;
my ( $authReturn, $err ) = authenticate (
@chrisjacob
chrisjacob / README.md
Created March 24, 2011 14:20
QUICK setup Github Pages + Cloud9 IDE for HTML/CSS/JavaScript hacking

QUICK setup Github Pages + Cloud9 IDE for HTML/CSS/JavaScript hacking

GitHub + GitHub Pages

  1. Get a GitHub account: https://github.com/
  2. Github > Dashboard > New Repository ... https://github.com/repositories/new
  3. Enter a Project Name and Description; click "Create Repository"
  4. On the project page ignore the suggested setup instructions... instead click on the "Admin" button
  5. Check the "GitHub Pages" checkbox... You'll get a popup.
  6. Click the "Automatic GitHub page Generator" button.
  7. Choose a funky colour... or go safe with just white... then click "Create Page" button
@jpr5
jpr5 / bot.rb
Created April 26, 2011 07:13
XMPP/Ruby Bot for HipChat
#!/usr/bin/env ruby
#
# Script: HipChat bot in Ruby
# Author: Jordan Ritter <jpr5@darkridge.com>
#
unless `rvm-prompt i g`.chomp == "ree@xmpp"
exec("rvm ree@xmpp ruby #{$0}")
end