Skip to content

Instantly share code, notes, and snippets.

@luk-
luk- / json_file.js
Created October 30, 2011 07:21
Small script used to convert text list of JS events to JSON
fs = require('fs');
var file;
var obj = new Object;
fs.readFile('events.txt', 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
file = data.split("\n");
@luk-
luk- / class.uber_api_client.php
Created November 3, 2011 22:13
This API 2.0 script will disable auto-suspension on every active client's services in Ubersmith
<?php
class uber_api_client
{
const VERSION = '1.0';
protected $options = array(
'debug' => false,
'timeout' => 30,
'server' => 'http://localhost/',
@luk-
luk- / gist:1398716
Created November 28, 2011 01:31
silk request
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.1.0-80)
AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true
@luk-
luk- / gist:1440863
Created December 7, 2011 00:53
Reply from Senator Gillibrand about PROTECT IP / PIPA

November 30, 2011

Dear Lucas,

Thank you for writing to me regarding S. 968, the PROTECT IP Act of 2011. I understand your concerns.

I am a cosponsor of this legislation because I believe that we must protect American intellectual property against foreign websites that infringe upon our rights. By empowering the Attorney General of the United States to go after foreign infringing websites, this legislation becomes a necessary tool to ensure that U.S. companies remain competitive in the world marketplace. I recognize that there are technical concerns with the enforcement of this bill that need to be addressed. I am committed to working with my colleagues in the United States Senate to ensure that this legislation protects the Constitutional rights of Americans and does not stifle lawful free speech or innovation on the internet.

Thank you again for writing to express your concerns, and I hope that you keep in touch with my office regarding future legislation. For more information on this and othe

var request = require('request');
//request('http://s3.amazonaws.com/data.tumblr.com/tumblr_lgkzjx9pid1qarvg9o1_1280.png?AWSAccessKeyId=AKIAJ6IHWSU3BX3X7X3Q&Expires=1323321189&Signature=sVZ1X4z/LXhV7gpiNvtKdwUQB1E=').pipe(require('fs').createWriteStream("awesome.jpg"))
//request('http://www.tumblr.com/photo/1280/13859988881/1/tumblr_lgkzjx9pid1qarvg9').pipe(require('fs').createWriteStream("awesome.jpg"))
@luk-
luk- / error.php
Created January 10, 2012 01:38
pear error
<?php
return PEAR::raiseError ('error message', -1);
//end
//or do
if (!result) {
return PEAR::raiseError ('error message', -1);
<?php
require_once dirname(__FILE__) .'/class.uber_api_client.php';
$client = new uber_api_client('http://instance-url/','admin','pass');
try {
$result = $client->call('support.ticket_list',array(
'type' => 'closed',
'order_by' => 'timestamp'
{
"48492051" : {
"name" : "Peking Wok"
, "street" : "6 Price Chopper Plz"
, "city" : "Mechanicville"
, "state" : "NY"
, "lat" : "42.910194"
, "lon" : "-73.685118"
}
, "85729672" : {
setopt append_history
setopt inc_append_history
setopt extended_history
setopt hist_find_no_dups
setopt hist_reduce_blanks
setopt glob
@luk-
luk- / ajax.html
Created March 10, 2012 02:31
for Todd
<!DOCTYPE html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var get_servlet_call = function (url) {
$.get (url, function (data) {
// this callback function is called on successful return of the url passed to $.get
// function (data) is the callback here — in javascript it's considered an anonymous function.
alert(data);