Skip to content

Instantly share code, notes, and snippets.

View thegoleffect's full-sized avatar

Van Nguyen thegoleffect

View GitHub Profile
@thegoleffect
thegoleffect / TurnipPrices.cpp
Created June 2, 2020 22:30 — forked from Treeki/TurnipPrices.cpp
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
var React = require('react/addons'),
TestUtils = React.addons.TestUtils,
TestContext = require('./TestContext'),
App = require('./App.jsx'),
app = TestContext.getRouterComponent(App);
describe('App', function() {
it('has something', function() {
expect(app.getDOMNode().textContent).toContain('something');
});
define([
], function() {
return {
componentDidMount: function() {
this._boundForceUpdate = this.forceUpdate.bind(this, null);
this.getBackboneObject().on("all", this._boundForceUpdate, this);
},
componentWillUnmount: function() {
this.getBackboneObject().off("all", this._boundForceUpdate);
},
# run this as root
while [ 1 ]; do echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload; done
# or as an upstart job
script
echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload
end script
respawn
# now any process can run this or do the equivalent with sockets to trigger reload
%% Read image and convert to grayscale
img = imread('pic.jpg');
img = rgb2gray(img);
%% Define grayscale representations of 0-255
chars = fliplr([' ', '.', ',', ':', '-', '=', '+', '*', '#', '%', '@']);
step = 256 / 11;
%% Cut image so its size is 8*w times 13*h
imgSize = size(img);
import mechanize
from bs4 import BeautifulSoup
from datetime import datetime
TGT_DATE = 'MONTH DAY, YEAR' #i.e. 'September 30, 2014'
OFFICE_ID = '503' # officeid for SF DMV. See HTML code for other office ids
NUMBERITEMS = 'Num' # number of tasks for dmv; should be between 1-3
FIRSTNAME = 'FIRST_NAME'
LASTNAME = 'LAST_NAME'
# Number looks like (TELAREA) TELPREFIX-TELSUFFIX

Unionize: network superpowers for your docker containers

Unionize lets you connect together docker containers in arbitrarily complex scenarios.

Just check those examples.

LAMP stack with a private network between the MySQL and Apache containers

Let's create two containers, running the web tier and the database tier:

@thegoleffect
thegoleffect / clark.coffee
Created April 11, 2012 21:19 — forked from friggeri/clark.coffee
Sparklines in CoffeeScript
#!/usr/bin/env coffee
ticks = ['▁','▂','▃','▄','▅','▆','▇','█']
exports.clark = (data) ->
m = Math.min data...
n = (Math.max(data...)-m)/(ticks.length - 1)
(ticks[(t-m)/n >> 0] for t in data).join('')
if require.main == module
data = process.argv
@thegoleffect
thegoleffect / minimal-logger.coffee
Created January 18, 2012 13:56 — forked from technoweenie/minimal-logger.coffee
Minimal node.js logger
# logger = require('logger').create()
# logger.info("blah")
# => [2011-3-3T20:24:4.810 info (5021)] blah
# logger.debug("boom")
# =>
# logger.level = Logger.levels.debug
# logger.debug(function() { return "booom" })
# => [2011-3-3T20:24:4.810 error (5021)] booom
class Logger
constructor: (options) ->