Skip to content

Instantly share code, notes, and snippets.

View weppos's full-sized avatar

Simone Carletti weppos

View GitHub Profile
@weppos
weppos / git-prs.md
Created March 28, 2016 23:30
PRs as Git Branches

If you want to download GitHub PRs to your local repository, you can use a little trick to download them as local branches.

Open the repository configuration file (.git/config) and search for the origin block. Change it from:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:USERNAME/REPOSITORY.git
Rehearsal -----------------------------------------
lib: 0.560000 0.000000 0.560000 ( 0.565598)
own: 0.640000 0.010000 0.650000 ( 0.651338)
-------------------------------- total: 1.210000sec
user system total real
lib: 0.650000 0.000000 0.650000 ( 0.666613)
own: 0.650000 0.010000 0.660000 ( 0.651895)

Keybase proof

I hereby claim:

  • I am weppos on github.
  • I am weppos (https://keybase.io/weppos) on keybase.
  • I have a public key whose fingerprint is C7F3 8EE9 2951 BB47 501A 63B1 420D A82A 9893 98DF

To claim this, I am signing this object:

@weppos
weppos / gist:9461565
Created March 10, 2014 08:49
RoboWhois + C# example: get the WHOIS record for a domain.
public string WhoIs(string domainName, string myApiKey)
{
string url = "http://api.robowhois.com/whois/" + domainName;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = WebRequestMethods.Http.Get;
request.Credentials = new NetworkCredential(myApiKey, "X");
try
{
WebResponse response = request.GetResponse();
package main
import (
"fmt"
"io/ioutil"
"os/exec"
"strings"
)
func opensslModulus(command string, content string) (string, error) {
@weppos
weppos / 44.go
Last active April 29, 2025 20:49
A Tour of Go Exercise: Fibonacci closure
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
f2, f1 := 0, 1
return func() int {
f := f2
@weppos
weppos / fliwn.rb
Created December 6, 2012 16:38
Script to download a Flickr photoset.
#!/usr/bin/env ruby -wKU
require 'rubygems'
require 'flickraw'
require 'open-uri'
require 'fileutils'
FlickRaw.api_key = "YOUR_API_KEY"
FlickRaw.shared_secret = "YOUR_SHARED_SECRET"
@weppos
weppos / tlds.yml
Last active October 11, 2015 19:18
Whois fixtures
ae.org:
_server: whois.centralnic.com
_subdir: ae.org
status_available: u34jedzcq.ae.org
status_registered: kidzlink.ae.org
ar.com:
_server: whois.centralnic.com
_subdir: ar.com
status_available: u34jedzcq.ar.com
status_registered: hotel.ar.com
@weppos
weppos / whois.asp
Created June 7, 2012 18:38
RoboWhois + ASP example: get the WHOIS record for a domain.
<%
' Requests the WHOIS record for the domain
' and returns a String containing the WHOIS response.
Function Whois(url)
Dim objXmlHttp
Set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
objXmlHttp.Open "GET", url, False, "YOUR_API_KEY", "X"
@weppos
weppos / robowhois.py
Created June 7, 2012 18:30
RoboWhois + Python example: get the WHOIS record for a domain.
import urllib2
class RoboWhois:
def __init__(self, api_key):
self.username = api_key
self.password = "X"
def whois(self, domain):
template = "http://api.robowhois.com/whois/%s"