Skip to content

Instantly share code, notes, and snippets.

View DanH42's full-sized avatar

Dan Hlavenka DanH42

View GitHub Profile
@DanH42
DanH42 / addr.json
Last active February 6, 2017 21:52
Dynamic DNS using the CloudFlare API
{}
@DanH42
DanH42 / Date.js
Created October 7, 2016 15:22
Lies to other code on the page about the current date/time
Date = function(Date){
var fakeDate = 1475852400000; // Fri Oct 07 2016 10:00:00 GMT-0500 (CDT)
var bind = Function.bind;
var unbind = bind.bind(bind);
function NewDate(){
if(arguments.length === 0)
arguments = [fakeDate];
return new (unbind(Date, null).apply(null, arguments));
@DanH42
DanH42 / likeAllComments.js
Created September 16, 2016 16:38
Expands collapsed threads and then likes every comment on the current Facebook page
(function expandThreads(){
var count = 0;
var els = document.querySelectorAll('.UFIReplySocialSentenceLinkText, .UFIPagerLink');
console.log("Expanding", els.length, "threads");
for(var i = 0; i < els.length; i++){
if(els[i].innerText.indexOf("Hide") === -1){
els[i].click();
count++;
}
}
#!/usr/bin/python
text = '22T189RSNH11T .264749,"OIO""O"O,RSNDLHNLDHDSDSHSDCCCRCCNHNNK.ETFGWU .E0E T6839937643?!,"O'
text += '!RLHDSRSCSDLNCCCCCDNUV1E RCHN2E0E 68495RSNNRSRRLHNCLHDCDSDSDNCCNCCCH,"?,HJQKV"???,DRLCCC'
#text = '68753RCNRLNYYWGGWUFMGKXKXQZKXJZZKK'
register = [1,1,1,1,1,1,1,0]
spoke = 0
spokes = [
var fs = require('fs');
var proxy = require('http-proxy');
var crypto = require("crypto");
var router = {
'domain1.com': "127.0.0.1:8001",
'domain2.com': "127.0.0.1:8002",
'domain3.com': "127.0.0.1:8003",
'domain4.com': "127.0.0.1:8004"
};
var fs = require('fs');
var proxy = require('http-proxy');
var crypto = require("crypto");
var router = {
'domain1.com': "127.0.0.1:8001",
'domain2.com': "127.0.0.1:8002",
'domain3.com': "127.0.0.1:8003",
'domain4.com': "127.0.0.1:8004",
'domain5.com': "127.0.0.1:8005"
@DanH42
DanH42 / markov.php
Last active August 29, 2015 14:17
Markov Science!
<?php
/*
PHP Markov Chain text generator 1.0
Copyright (c) 2008-2010, Hay Kranen <http://www.haykranen.nl/projects/markov/>
Fork on Github: < http://github.com/hay/markov >
License (MIT / X11 license)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@DanH42
DanH42 / COBOL-AJAX.js
Last active August 29, 2015 14:07
A COBOL programmer tries to use AJAX
// IDENTIFICATION DIVISION.
// PROGRAM_ID. AJAX_EXAMPLE.
//*
// ENVIRONMENT DIVISION.
//*
// DATA DIVISION.
// WORKING_STORAGE SECTION.
var AJAX = null;
var URL = "EXAMPLE.TXT";
var RESPONSE = "";
@DanH42
DanH42 / led_udp.ino
Last active August 29, 2015 14:06
Read color codes (0-255, ['#', r, g, b, '\n']) from incoming UDP packets and write them out to LEDs, and adjust brightness with ['%', n, '\n']
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 0, 20);
unsigned int localPort = 8888;
EthernetUDP Udp;
unsigned char packetBuffer[UDP_TX_PACKET_MAX_SIZE];

Keybase proof

I hereby claim:

  • I am DanH42 on github.
  • I am danhlavenka (https://keybase.io/danhlavenka) on keybase.
  • I have a public key whose fingerprint is E68A 615B 6413 29DF 7EE4 3B28 FBB7 F72D E5D8 6AC5

To claim this, I am signing this object: