Skip to content

Instantly share code, notes, and snippets.

View fagiani's full-sized avatar

Paulo Fagiani fagiani

View GitHub Profile
@hcooper
hcooper / proxy.py
Created November 9, 2011 19:36
A simple threaded caching HTTP proxy
#!/usr/bin/python
"""
A simple threaded caching HTTP proxy.
Hereward Cooper <[email protected]>
v0.1
"""
LISTENPORT = 8000
LISTENINT = '127.0.0.1'
@atiw003
atiw003 / wordpress_importer.rb
Created May 20, 2012 06:59 — forked from Oneiroi/wordpress_importer.rb
Import a WordPress database and generate markdown files for Jekyll
# based on the import script by icebreaker, which is based on mojombo's
# https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/wordpress.rb
# https://gist.github.com/303570
# edited to rewrite image URLs to use my CloudFront URL
require 'rubygems'
require 'sequel'
require 'fileutils'
require 'yaml'
@avibryant
avibryant / gist:3200554
Created July 29, 2012 17:47
The Regex Game
The Regex Game
Avi Bryant
This is a game for two programmers, although it's easy to imagine variations for more.
It can be played over email, twitter, or IM, but it's easy to imagine a custom web app for it, and I encourage someone to build one.
Each player starts by thinking of a regular expression. The players should decide beforehand on dialect and length restrictions (eg, has to be JavaScript-compatible and under 20 characters).
They don't reveal the Regex, but if playing over email etc, should send each other a difficult to brute force hash (eg bcrypt) of the Regex for later verification.
They do reveal two strings: one which the Regex will match, and one which it will not.
@toolmantim
toolmantim / host_based_tld_length.rb
Last active November 18, 2020 17:23
Reconfigures Rails ActionDispatch's TLD handling dynamically based on the request host, so you don't have to mess with config.action_dispatch.tld_length for cross-device testing using xip.io and friends
# Reconfigures ActionDispatch's TLD handling dynamically based on the request
# host, so you don't have to mess with config.action_dispatch.tld_length for
# cross-device testing using xip.io and friends
#
# Examples:
# use Rack::HostBasedTldLength, /xip\.io/, 5
class Rack::HostBasedTldLength
def initialize(app, host_pattern, host_tld_length)
@app = app
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active March 3, 2025 07:58
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@v9n
v9n / deploy.rb
Last active May 31, 2016 02:09
Config file for Mina with WP-CLI
require 'mina/git'
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
# branch - Branch name to deploy. (needed by mina/git)
set :user, 'kurei'
set :domain, 'axcoto.com'
@pricees
pricees / Ruby Database Url -> Config YAML
Last active August 15, 2024 15:15
Rails database connection, url to yaml
#########################################################
#
# This method takes a db connection url and returns rails
# config YAML
#
##########################################################
require "uri"
require "yaml"
@ErikEvenson
ErikEvenson / Vagrantfile
Last active December 11, 2024 19:06
Vagrant config
# This configuration will set up a database (db) and a web server (web) VM.
# Assumes the use of VirtualBox 4.3.14-95030 as a provider.
# Uses vagrant-vbguest plugin (https://github.com/dotless-de/vagrant-vbguest)
# to keep VirtualBox Guest Addition wrangled.
# Configuration
# Machine-specific configuration
DB_INSTALL_SCRIPT = "vagrant_data/db/install.sh"
@tadast
tadast / ssl_puma.sh
Last active January 21, 2025 16:20 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@brandonmwest
brandonmwest / example.cs
Last active January 7, 2025 07:39
Generating base64-encoded Authorization headers in a variety of languages
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue(
"Basic",
Convert.ToBase64String(
System.Text.ASCIIEncoding.ASCII.GetBytes(
string.Format("{0}:{1}", username, password))));