Skip to content

Instantly share code, notes, and snippets.

View ecto's full-sized avatar
🙂
building things

Cam Pedersen ecto

🙂
building things
View GitHub Profile
@ecto
ecto / gist:5393759
Last active December 16, 2015 06:48
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) {
char line[80];
FILE *fr;
NSString *path = @"/path/to/long/file";
struct stat info;
stat([path UTF8String], &info);
off_t lastSize = info.st_size;
fr = fopen([path UTF8String], "rt");
@ecto
ecto / gist:4734484
Created February 7, 2013 21:36
bork
npm@1.2.10 /usr/local/lib/node_modules/npm
~ [ npm install -g express v0.8.18 ] 3:35 PM
npm info it worked if it ends with ok
npm info using npm@1.2.10
npm info using node@v0.8.18
npm ERR! TypeError: Object info has no method 'verbose'
npm ERR! at RegClient.regRequest [as request] (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:43:14)
npm ERR! at RegClient.get_ (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:112:8)
npm ERR! at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:37:12)
@ecto
ecto / browser.js
Last active December 12, 2015 03:58
Challenge derivation test
// include CryptoJS
var message = '12345678901234567890123456789012';
var iv = CryptoJS.enc.Utf8.parse('1234567890123456');
var challengeKey = 'fe8844b73775265aef8839bf39de68a5aec6b0f447034472e8ff937bd9046e91';
var key = CryptoJS.enc.Hex.parse(challengeKey);
var challenge = CryptoJS.AES.encrypt(message, key, {
mode: CryptoJS.mode.CFB,
iv: iv
var module = (function() {
var _private = {
i:5,
get : function() {
console.log('current value:' + this.i);
},
set : function( val ) {
this.i = val;
},
run : function() {
/*
Example of achieving compatibility with AMD and standard CommonJS by putting boilerplate around the standard CommonJS module format:
*/
(function(define){
define(function(require,exports){
// module contents
var dep1 = require("dep1");
exports.someExportedFunction = function(){...};
//...
diff --git a/src/db.c b/src/db.c
index 6447838..ad28b1c 100644
--- a/src/db.c
+++ b/src/db.c
@@ -280,6 +280,31 @@ void keysCommand(redisClient *c) {
setDeferredMultiBulkLength(c,replylen,numkeys);
}
+void countCommand(redisClient *c) {
+ dictIterator *di;
@ecto
ecto / gist:3195116
Created July 28, 2012 22:59
Minecraft strobe light
var Minecraft = require('minecraft');
var mc = new Minecraft({
user: 'hello',
pass: 'world',
salt: 'salty'
});
var day = true;
make -C out BUILDTYPE=Release
make[1]: Entering directory `/private/var/root/node-v0.8.1/out'
CC(target) /private/var/root/node-v0.8.1/out/Release/obj.target/http_parser/deps/http_parser/http_parser.o
LIBTOOL-STATIC /private/var/root/node-v0.8.1/out/Release/libhttp_parser.a
File "./gyp-mac-tool", line 154
fd = os.open(lockfile, os.O_RDONLY|os.O_NOCTTY|os.O_CREAT, 0o666)
^
SyntaxError: invalid syntax
make[1]: *** [/private/var/root/node-v0.8.1/out/Release/libhttp_parser.a] Error 1
make[1]: Leaving directory `/private/var/root/node-v0.8.1/out'
make[1]: Entering directory `/private/var/root/node-v0.8.1/out'
CC(target) /private/var/root/node-v0.8.1/out/Release/obj.target/http_parser/deps/http_parser/http_parser.o
In file included from /usr/include/sys/types.h:79,
from ../deps/http_parser/http_parser.h:30,
from ../deps/http_parser/http_parser.c:24:
/usr/include/sys/_types.h:94: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__darwin_blkcnt_t'
/usr/include/sys/_types.h:95: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__darwin_blksize_t'
/usr/include/sys/_types.h:96: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__darwin_dev_t'
/usr/include/sys/_types.h:99: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__darwin_gid_t'
GET /phpldapadmin/ 200 3ms
GET /phpldapadmin/htdocs/ 200 2ms
GET /phpldap/ 200 1ms
GET /phpldap/htdocs/ 200 1ms
GET /admin/ 200 1ms
GET /admin/htdocs/ 200 1ms
GET /admin/ldap/ 200 1ms
GET /admin/ldap/htdocs/ 200 1ms
GET /admin/phpldap/ 200 1ms
GET /admin/phpldap/htdocs/ 200 1ms