Skip to content

Instantly share code, notes, and snippets.

@cjlucas
cjlucas / announce.php
Created April 16, 2021 04:46 — forked from nsuan/announce.php
Bitstorm Tracker
<?php
/*
* Bitstorm - A small and fast Bittorrent tracker
* Copyright 2008 Peter Caprioli
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
@cjlucas
cjlucas / rundown.py
Last active August 29, 2015 14:27
Quick rundown of python
## The basics
print('Hello world')
## Primatives types
a_string = 'hithere'
a_int = 5
a_float = 5.5
a_list = [1, 2, 3]
a_tuple = tuple(a_list) # tuple is an immutable list
a_dict = {'key': 'value'} # dict is a hash map
@cjlucas
cjlucas / occi_boilerplate.cc
Last active August 29, 2015 14:27
OCCI Boilerplate
#include <occi.h>
#include <stdio.h>
using namespace oracle::occi;
int main(int argc, char *argv[])
{
auto env = Environment::createEnvironment();
auto conn = env->createConnection("username", "password", "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=XE)))");
@cjlucas
cjlucas / gist:051fc83156d85a5ef133
Created May 7, 2015 03:29
Channels are slow. Goroutines are fast.
func BenchmarkSingleGoroutine(b *testing.B) {
in := make(chan struct{})
out := make(chan struct{})
go func(in, out chan struct{}) {
for {
b := <-in
out <- b
}
}(in, out)
@cjlucas
cjlucas / ListTest.java
Last active August 29, 2015 13:58
ListTest
package myList;
import myList.List;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Created by chris on 4/3/14.
*/
@cjlucas
cjlucas / rtorrent_xmlrpc.py
Created October 23, 2012 07:35 — forked from query/rtorrent_xmlrpc.py
Python module for interacting with rtorrent's XML-RPC interface directly over SCGI.
#!/usr/bin/python
# rtorrent_xmlrpc
# (c) 2011 Roger Que <[email protected]>
#
# Python module for interacting with rtorrent's XML-RPC interface
# directly over SCGI, instead of through an HTTP server intermediary.
# Inspired by Glenn Washburn's xmlrpc2scgi.py [1], but subclasses the
# built-in xmlrpclib classes so that it is compatible with features
# such as MultiCall objects.