Skip to content

Instantly share code, notes, and snippets.

View vcabbage's full-sized avatar

Kale Blankenship vcabbage

View GitHub Profile
@vcabbage
vcabbage / gist:39602eddd6786dca3cbc
Last active August 29, 2015 14:23
CLUS Twitter Spammer for Charity
'use strict';
var request = require('request');
var Twitter = require('twitter');
var TWITTER_KEY = '';
var TWITTER_SECRET = '';
var TWITTER_ACCESS_KEY = '';
var TWITTER_ACCESS_SECRET = '';
var client = new Twitter({
from ipaddress import ip_address
def main():
print(get_mask_length('192.168.5.65', '192.168.5.111'))
print(get_mask_length('2001:dead::', '2001:dead:beef::'))
def get_mask_length(ip1, ip2):
ip1_int = int(ip_address(ip1))
ip2_int = int(ip_address(ip2))
unique_bits_int = abs(ip1_int - ip2_int) + 1 #add 1 to be inclusive of both addresses
135 - heap objects before creating timers
22570169 - heap objects after creating timers
8031998 - heap objects after running GC, before timers expire
163 - heap objects after timers expire

Keybase proof

I hereby claim:

  • I am vcabbage on github.
  • I am vcabbage (https://keybase.io/vcabbage) on keybase.
  • I have a public key ASBlA-ZnHeU9R61Gy47E-C0fkJAPJ24A4R391nDL0S0uLwo

To claim this, I am signing this object:

@vcabbage
vcabbage / command-timeout-pre17.go
Last active May 20, 2021 07:33
Command timeout without context
package main
import (
"bytes"
"fmt"
"os/exec"
"time"
)
func main() {
@vcabbage
vcabbage / command-context-timeout.go
Created September 24, 2016 22:29
Command timeout with context
package main
import (
"context"
"fmt"
"os/exec"
"time"
)
func main() {
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
"golang.org/x/sync/singleflight"
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
)
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
"golang.org/x/sync/singleflight"
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
"golang.org/x/sync/singleflight"