An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
Includes HTTP-Header information in the output
var DEFAULT_MAX_LISTENERS = 12 | |
function error(message, ...args){ | |
console.error.apply(console, [message].concat(args)) | |
console.trace() | |
} | |
class EventEmitter { | |
constructor(){ | |
this._maxListeners = DEFAULT_MAX_LISTENERS |
var libpath = require('path'); | |
var http = require('http'); | |
var fs = require('fs'); | |
var url = require('url'); | |
var bind_port = 8001; | |
var path = "/path/to/your/base_directory/"; | |
http.createServer(function (request, response) { | |
var uri = url.parse(request.url).pathname; | |
var filename = libpath.join(path, uri); |
var express = require('express'); | |
var sys = require('sys'); | |
var oauth = require('oauth'); | |
var app = express.createServer(); | |
var _twitterConsumerKey = "YOURTWITTERCONSUMERKEY"; | |
var _twitterConsumerSecret = "YOURTWITTERCONSUMERSECRET"; | |
function consumer() { |
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"plugins": ["react"], | |
"ecmaFeatures": { |
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { | |
// no easing, no acceleration | |
linear: function (t) { return t }, | |
// accelerating from zero velocity | |
easeInQuad: function (t) { return t*t }, | |
// decelerating to zero velocity |
const net = require('net'); | |
const exec = require('child_process').exec; | |
const os = require('os'); | |
function run(cmd) { | |
return new Promise((resolve, reject) => { | |
exec(cmd, (err, stdout) => { | |
if (err) { | |
return reject(err); | |
} |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
Includes HTTP-Header information in the output
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// c++ -o nanopng nanopng.cpp && ./nanopng /tmp/foo.png | |
#include <cstdio> | |
// write an uncompressed PNG file from a uint8 RGB buffer | |
struct Png { | |
FILE*f; unsigned int tab[256], crc; ~Png() { fclose(f); } | |
Png(const char* fn, int w, int h, const unsigned char* c) { | |
crc=0x575e51f5;unsigned char d[]={137,80,78,71,13, | |
10,26,10,0,0,0,13,73,72,68,82,73,68,65,84,120,1,0, | |
0,0,73,69,78,68,174,66,96,130};/*chunk headers*/ |
const kCRCTable = new Int32Array([ | |
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, | |
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, | |
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, | |
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, | |
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, | |
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, | |
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, | |
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, | |
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, |