Skip to content

Instantly share code, notes, and snippets.

@toddself
toddself / shitty-wifi.sh
Created January 22, 2015 17:01
shitty wifi
#!/bin/bash
while true; do
trap "exit 0" SIGINT
CEIL=10
timeout=0
ip link show eth0 | grep UP > /dev/null
ISUP=$?
let "timeout = $RANDOM % $CEIL + 1"
'use strict';
var fs = require('fs');
var path = require('path');
var readdirp = require('readdirp')
module.exports = function(baseDir, outFile) {
var files = [];
var output = '';
09:19:14 ~/src/test
↳ cat package.json
{
"name": "src",
"scripts": {
"test": "which tap"
},
"version": "1.0.0",
"description": "",
"main": "index.js",
  1. stop your vm & backup your disk cp hdd.img hdd-backup.img
  2. resize the disk image hdiutil resize -size [size]g hdd.img
  3. boot into linux and run sudo parted /dev/[disk]
  4. if your swap partition is in the way (located immediately following your primary parition), delete & recreate it
  5. rm [disk id of swap partition]
  6. mkpartfs primary linux-swap
  7. start should be 1 gb away from end of disk
  8. end should be end of disk
  9. save and quit, reboot
  10. verify that the new swap is active swapon -s -- if not then mkswap /dev/[disk][partition id]
@toddself
toddself / genius-blocker.js
Last active March 29, 2016 22:03
Prevent any of the genius annotations from running on your site
var genius = /genius/i
// prevent genius.it/[your site]
if (genius.test(document.referrer) || genius.test(window.location.href)) {
document.location = 'https://stopitgenius.xyz'
}
// prevent the bookmarklet
var setAttribute = window.HTMLElement.prototype.setAttribute
window.HTMLElement.prototype.setAttribute = function (attr, val) {
if ((attr === 'src' || attr === 'href') && genius.test(val)) {
const EventEmitter = require('events')
function ComputedModel (props) {
const base = Object.create(new EventEmitter())
const keys = Object.keys(props)
for (let i = 0, len = keys.length; i < len; i++) {
const key = keys[i]
const prop = props[key]
Object.defineProperty(base, `_${key}`, {writable: true, value: prop})
if (typeof prop === 'function') {
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var history = require('sheet-router/history');
var sheetRouter = require('sheet-router');
var document = require('global/document');
var href = require('sheet-router/href');
var hash = require('sheet-router/hash');
var hashMatch = require('hash-match');
var sendAction = require('send-action');
var mutate = require('xtend/mutable');
var assert = require('assert');
1 1/2 cups cake flour
1/4 sugar
1/2 tsp salt
1/2 tsp baking soda
1/2 tsp baking powder
3/4 whole milk
3/4 whole milk yogurt
2 egg whites
4 tbls butter, melted
shot of vanilla extract
@toddself
toddself / index.js
Last active June 30, 2016 00:09
requirebin sketch
const choo = require('choo')
// app 1
const app1 = choo()
app1.model({
state: {
data: 'app1',
},
reducers: {
@toddself
toddself / index.js
Created July 2, 2016 00:52
requirebin sketch
const pull = require('pull-stream')
const Notify = require('pull-notify')
const notify = Notify()
pull(notify.listen(), pull.drain(console.log))
notify('hello', 'world')
notify.end()