Skip to content

Instantly share code, notes, and snippets.

View kost's full-sized avatar
💭
I'm upto something

kost kost

💭
I'm upto something
View GitHub Profile
@torsten
torsten / proxy.rb
Last active April 30, 2024 17:53
A quick HTTP proxy server in Ruby.
#!/usr/bin/env ruby
# A quick and dirty implementation of an HTTP proxy server in Ruby
# because I did not want to install anything.
#
# Copyright (C) 2009-2014 Torsten Becker <torsten.becker@gmail.com>
#
# 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,
#!/bin/bash
# creates ssh tunnel
ssh -N -f -L 5353:localhost:5353 remote-host
# makes udp -> tcp stream
socat UDP-RECVFROM:53,fork TCP:localhost:5353
@mwbrooks
mwbrooks / UntitledAppDelegate.m
Created January 28, 2011 18:18
Load a PhoneGap-iPhone app from a custom start page.
//
// UntitledAppDelegate.m
// Untitled
//
// Created by Michael Brooks on 11-01-28.
// Copyright __MyCompanyName__ 2011. All rights reserved.
//
#import "UntitledAppDelegate.h"
#import "PhoneGapViewController.h"
@rbm
rbm / invalidate-cf-path.rb
Created August 29, 2011 09:27
Invalidate CloudFront path using fog
#!/usr/bin/env ruby -w
require 'rubygems'
require 'fog'
require 'pp'
AWS_ACCESS_KEY = ENV['AWS_ACCESS_KEY_ID']
AWS_SECRET_KEY = ENV['AWS_SECRET_ACCESS_KEY']
def get_cf_connection()
@garnaat
garnaat / eucarc.sh
Created October 13, 2011 12:20
Example of eucarc file
EUCA_KEY_DIR=$(dirname $(readlink -f ${BASH_SOURCE}))
export S3_URL=http://173.205.188.130:8773/services/Walrus
export EC2_URL=http://173.205.188.130:8773/services/Eucalyptus
export EC2_PRIVATE_KEY=${EUCA_KEY_DIR}/euca2-garnaat-e5ec560d-pk.pem
export EC2_CERT=${EUCA_KEY_DIR}/euca2-garnaat-e5ec560d-cert.pem
export EC2_JVM_ARGS=-Djavax.net.ssl.trustStore=${EUCA_KEY_DIR}/jssecacerts
export EUCALYPTUS_CERT=${EUCA_KEY_DIR}/cloud-cert.pem
export EC2_ACCESS_KEY='999999999999999999999999999999999999'
export EC2_SECRET_KEY='00000000000000000000000000000000000000'
# This is a bogus value; Eucalyptus does not need this but client tools do.
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active September 8, 2023 17:57
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
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:
The above copyright notice and this permission notice shall be included in
@mediabounds
mediabounds / floatsign.sh
Last active March 31, 2024 18:43
A small bash script to re-sign iOS applications.
# !/bin/bash
# Copyright (c) 2011 Float Mobile Learning
# http://www.floatlearning.com/
#
# 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
require 'rubygems'
require 'em-proxy'
require 'http_tools'
require 'uuid'
# > ruby em-proxy-http.rb
# > curl --proxy localhost:8080 www.google.com
host = "0.0.0.0"
port = 8080
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@carlhoerberg
carlhoerberg / app.rb
Created January 26, 2012 20:55
Webrick ssl example
require 'sinatra/base'
require 'openssl'
require 'webrick'
require 'webrick/https'
class App1 < Sinatra::Base
get '/' do
'app1'
end
end