Skip to content

Instantly share code, notes, and snippets.

View DanBUK's full-sized avatar

Daniel Bartlett DanBUK

View GitHub Profile

Keybase proof

I hereby claim:

  • I am danbuk on github.
  • I am danbuk (https://keybase.io/danbuk) on keybase.
  • I have a public key ASDhqRzstvgNicHW9FQG2gzVXLrev2bH1eGRLxQ_6zUZbQo

To claim this, I am signing this object:

@DanBUK
DanBUK / init.js
Created January 15, 2016 00:18
hangups/lib/init.js
// Generated by CoffeeScript 1.10.0
(function() {
var CHAT_INIT_PARAMS, CHAT_INIT_URL, CLIENT_CONVERSATION_STATE_LIST, CLIENT_GET_SELF_INFO_RESPONSE, INITIAL_CLIENT_ENTITIES, Init, NetworkError, Q, find, fs, log, ref, ref1, req, request, syspath, uniqfn,
slice = [].slice;
request = require('request');
log = require('bog');
Q = require('q');
var unfav = document.getElementsByClassName('with-icn unfavorite js-tooltip')[0];
var fav = document.getElementsByClassName('with-icn favorite js-tooltip')[0];
var count = 0;
var max_count = 100;
var timInterval = setInterval(function () {
fav.click();
setTimeout(function () {
unfav.click();
count++;
if (count == max_count) clearInterval(timInterval);
@DanBUK
DanBUK / rsync_wrapper.c
Created March 6, 2013 07:55
rsync wrapper
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <pwd.h>
#define CONF_FILE "/etc/rsync_secure.conf"
typedef struct {
@DanBUK
DanBUK / hello.js
Last active December 14, 2015 11:39
TCP Hello TCP Daemon
#!/bin/env node
var NET = require('net');
var ClientHandler = function (conn) {
this.bkspace = new Buffer([8,8,8]);
this._conn = conn;
this._running = true;
this._remoteAddress = this._conn.remoteAddress;
this._remotePort = this._conn.remotePort;
@DanBUK
DanBUK / custom_c_arrays.c
Created October 31, 2012 18:34
i don't know what I hate segfaults
typedef struct {
int size;
short *digits;
} IntArray;
typedef struct {
int size;
IntArray **arrays;
} IntArrayOfArray;
@DanBUK
DanBUK / bugmulti.c
Created October 29, 2012 08:15
Program does "big multiplication" - Should be able to handle numbers of _ANY_ length
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* Program does "big multiplication"
Should be able to handle numbers of _ANY_ length
Input via stdin:-
N
@DanBUK
DanBUK / do_tim_over.js
Created October 20, 2012 22:09
timthumb.php DoS example
#!/usr/bin/env node
var domain = 'www.example.com';
var port = 80;
var ttpath = '/wp-content/themes/example/timthumb.php';
var src_list = [
'http://www.example.com/wp-content/uploads/2012/01/example.jpg',
'http://www.example.com/wp-content/uploads/2012/01/example1.jpg'
];
@DanBUK
DanBUK / find_primes.js
Created July 19, 2011 16:27
Find prime numbers
// Converted to Javascript by Daniel Bartlett [DanBUK] <dan@f-box.org>
// Source: http://en.wikibooks.org/wiki/Efficient_Prime_Number_Generating_Algorithms
var find_primes = function (max_prime) {
/* Get the square root of the upper limit. This will be the upper limit of the test prime array
for primes used to verify the primacy of any potential primes up to (max_prime). Primes greater than
(sqrtlim) will be placed in an array for extended primes, (xp), not needed for the verification
test. The use of an extended primes array is technically unnecessary, but helps to clarify that we
have minimized the size of the test prime array.
*/
@DanBUK
DanBUK / gist:1070014
Created July 7, 2011 17:13
nodester issue #122 example
> var o = /^.*$/;
> o
/^.*$/
> o.concat
> o.concat('asdf')
TypeError: Object /^.*$/ has no method 'concat'
at [object Context]:1:3
at Interface.<anonymous> (repl.js:171:22)
at Interface.emit (events.js:64:17)
at Interface._onLine (readline.js:153:10)