Skip to content

Instantly share code, notes, and snippets.

View j3lte's full-sized avatar

Jelte Lagendijk j3lte

View GitHub Profile
@j3lte
j3lte / node4chan.js
Last active December 15, 2015 21:29
NodeJS 4chan image downloaderFirst attempt, downloads all images from a board. OUTDATED! SEE: https://github.com/j3lte/chanarchive
//
// ******************************************************************
// THIS GIST IS OUTDATED. SEE : https://github.com/j3lte/chanarchive
// ******************************************************************
// URL Representation
/*
JSON representations of threads and indexes are exposed at the following URLs:
http(s)://api.4chan.org/board/res/threadnumber.json
@j3lte
j3lte / nodejs-ssh2.js
Created April 8, 2013 08:39
NodeJS simple ssh checker, want to make this work better in the future. This is just a simple implementation of SSH2-module from the npm registry
var Connection = require('ssh2');
var c = new Connection();
c.on('connect', function() {
console.log('Connection :: connect');
});
c.on('ready', function() {
console.log('Connection :: ready');
c.exec('uptime && echo && ps aux && echo && free', function(err, stream) {
if (err) throw err;
@j3lte
j3lte / sitecom-wps.js
Last active December 15, 2015 23:59
Sitecom WPS Calculator
/**
* SITECOM WPS KEY Calculator
*
* Calculates the WPS key of a Sitecom AP in the OUI range of 00:0C:F6
*/
/*
Checksum calculation, based on wps_pin_checksum in wps_common.c
Source: http://reaver-wps.googlecode.com/svn/trunk/src/wps/wps_common.c
*/
@j3lte
j3lte / simple-observer.js
Created April 9, 2013 11:46
Simple NodeJS observer. I needed a simple observer which would minify my app.js into app.min.js on saving the file. I'm sure this can be done more efficient, I just needed a small script inside my Javascript folder when developing a client-side app for a client of mine. This observer will minify it using packer (https://github.com/dreamerslab/no…
var fs = require("fs");
var forker = require('child_process');
var log = console.log;
log('\nRunning under Node.js version ' + process.versions.node + ' on ' + process.arch +
'-type processor, ' + process.platform + ' platform.');
var fileName = "app.js";
var fileNameMin = "app.min.js";
@j3lte
j3lte / jquery.jstockticker-1.1.1.js
Created April 16, 2013 14:20
jstockticker aanpassingen
/**
* Horizontal Stock Ticker for jQuery.
*
* @package jStockTicker
* @author Peter Halasz <skinner@gmail.com>
* @license http://www.gnu.org/licenses/gpl-3.0.txt GPL v3.0
* @copyright (c) 2009, Peter Halasz all rights reserved.
*/
( function($) {
@j3lte
j3lte / debug-node.js
Last active December 16, 2015 11:49
Little stacktrace code, can be implemented in your code to debug which functions are called, from where. Implemented in NodeJS. Easy to use!
/* LITTLE CODE DEBUGGER, call it with : console.log(__debug); */
Object.defineProperty(global, '__stack', { get: function() { var orig = Error.prepareStackTrace; Error.prepareStackTrace = function(_, stack) { return stack; }; var err = new Error; Error.captureStackTrace(err, arguments.callee); var stack = err.stack; Error.prepareStackTrace = orig; return stack; }});
Object.defineProperty(global, '__debug', { get: function(){ return "[+] Called (" + __stack[1].getLineNumber() + ' : ' + __stack[1].getFunctionName() + ") From ("+ __stack[2].getLineNumber() + ' : ' + __stack[2].getFunctionName() + ")"; }});
/* END DEBUG */
/* HOW TO USE
This can be traced, using
console.log(__debug);
In your console you will see lines like these:
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.
@j3lte
j3lte / index.js
Last active December 19, 2015 18:28
Part of routes/index.js in https://github.com/j3lte/node-mandelbrot
var Canvas = require('canvas');
function Mandeliter(cx, cy, maxiter)
{
var i;
var x = 0.0;
var y = 0.0;
for (i = 0; i < maxiter && x*x + y*y <= 4; ++i)
{
var tmp = 2*x*y;

Step 1: Clone the bundles into your Sublime Text packages directory

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus

Step 2: Restart Sublime Text 2

* [AdvancedNewFile](https://github.com/skuroda/Sublime-AdvancedNewFile)
* [AngularJS](https://github.com/angular-ui/AngularJS-sublime-package)
* [AngularJS (CoffeeScript)](https://github.com/Iristyle/Sublime-AngularJS-Coffee-Completions)
* [AngularJS Snippets](https://github.com/maxhoffmann/angular-snippets)
* [ApplySyntax](https://github.com/facelessuser/ApplySyntax)
* [Automatic Backups](https://github.com/joelpt/sublimetext-automatic-backups)
* [BracketHighlighter](https://github.com/facelessuser/BracketHighlighter)
* [ChangeQuotes](https://github.com/colinta/SublimeChangeQuotes)
* [Clipboard History](https://github.com/kemayo/sublime-text-2-clipboard-history)
* [Coffee Formatter](https://github.com/derekchiang/Sublime-CoffeeScript-Formatter)