Skip to content

Instantly share code, notes, and snippets.

View tildedave's full-sized avatar
🌮
Hungry

Dave King tildedave

🌮
Hungry
View GitHub Profile
@tildedave
tildedave / createFacebookTestUser.js
Last active May 25, 2016 22:29
Nightwatch Command for Creating Facebook Test User
var util = require('util');
var events = require('events');
var Promise = require('bluebird');
var request = Promise.promisify(require('request'));
var CreateFacebookTestUser = function() {
events.EventEmitter.call(this);
};
util.inherits(CreateFacebookTestUser, events.EventEmitter);
dave@margaret:~/workspace/isomorphic-react-without-node/duktape-1.0.2$ ./duk init.js react-0.12.2.js test.js
<div data-reactid=".1n7svbvilrt" data-react-checksum="1140200483">This is my content</div>
React.createClass({
getInitialState: function() {
return { loading: true }
},
componentDidMount: function() {
$.getJSON('/my/stuff', function (data) {
this.setState({ stuff: data, loading: false })
}.bind(this))
root@testing:/srv/www/current# npm install
npm WARN package.json [email protected] No repository field.
npm http GET https://registry.npmjs.org/chromedriver
npm http GET https://registry.npmjs.org/datejs
npm http GET https://registry.npmjs.org/gulp-cache
npm http GET https://registry.npmjs.org/event-stream
npm http GET https://registry.npmjs.org/gulp
npm http GET https://registry.npmjs.org/gulp-concat
npm http GET https://registry.npmjs.org/gulp-cssmin
npm http GET https://registry.npmjs.org/dotenv
Select an editor. To change later, run 'select-editor'.
1. /bin/ed
2. /bin/nano <---- easiest
3. /usr/bin/vim.basic
4. /usr/bin/vim.tiny
@tildedave
tildedave / bootstrap-graphite.sh
Last active March 15, 2020 20:03
bootstrap graphite in the fastest way possible. do not use in production
#!/bin/bash -e
# Bootstrap graphite in the fastest way possible
# Run as root because Graphite hardcodes everything to /opt/graphite and it's too annoying to change this
# I did this on Ubuntu 12.04 LTS. For other operating systems you may need to install different apt packages.
apt-get update
apt-get install -y gcc python-virtualenv python-dev python-cairo
virtualenv graphite
source graphite/bin/activate
pip install whisper carbon graphite-web
@tildedave
tildedave / gist:7371282
Last active December 20, 2018 20:16
Of course NaN is a number
user=> (/ 0.0 0.0)
NaN
user=> (type (/ 0.0 0.0))
java.lang.Double
dave@isis:~/workspace/reach/reach$ howdoi show halting problem undecidable
In other words, is there an important difference between saying H = M and the following description from the proof? The H machine is called Universal Turing Machine (UTM) and is able to simulate any other Turing Machine, including itself. If M is an Universal Turing Machine like H, it is ok to say H = M, otherwise this would be weird. I thought the halting problem was the problem of deciding if a given machine will halt regardless of its output(accept/reject). If a solution exists for a halting problem, it has to be something that analyses source code like a compiler/decompiler/disassembler instead of actually running it. If it needed to run it, obviously it would never determine on a "no" answer. That is why the proof works based on contradiction and it is kind hard to understand.
Basically it assumes first that exists such a machine that answers "yes" or "no" to any given input. [Hypothesis] Let's call this machine Q.
Assuming Q is v
@tildedave
tildedave / calculus.bas
Created January 20, 2012 10:31
polynomial derivatives/integrals in QBasic (written circa 1997 ?)
DECLARE SUB PolyDerv ()
DECLARE SUB PolyInt ()
CLS
PRINT "Calculus:": PRINT
PRINT "1. Evaluate derivative of a polynomial function"
PRINT "2. Evaluate integral of a polynomial function"
PRINT : INPUT ">", A: PRINT
IF A = 1 THEN PolyDerv
IF A = 2 THEN PolyInt
@tildedave
tildedave / carceri-save-subroutines.bas
Created January 20, 2012 10:22
save/load functionality for one of my QBasic games (circa 1996?)
SAVE: INPUT "What is your name?", N$
IF N$ = "" THEN N$ = "the_elf"
SAV$ = N$ + ".cas"
OPEN SAV$ FOR OUTPUT AS #1
PRINT #1, RM
PRINT #1, Level
PRINT #1, Orb
PRINT #1, Hp
PRINT #1, MaxHp
PRINT #1, GatesOpened