Skip to content

Instantly share code, notes, and snippets.

fizz = function f() {
fizz = function () {
fizz = function () {
fizz = f
return "Fizz"
}
}
}
buzz = function f() {
#!/bin/sh
# Update latest stable version, use it and migrate npm packages.
PREV_VER=$(nodebrew ls|grep current:|cut -d ' ' -f 2)
echo "Current version: $PREV_VER"
echo ""
echo "nodebrew install-binary stable"
nodebrew install-binary stable
if [ $? -ne 0 ]; then
# Already installed
@8bitDesigner
8bitDesigner / 1.md
Last active February 1, 2024 06:42
Git post-merge hook which, when you run `git merge` or `git pull` will then `bundle` if the project's Gemfile changed, or `npm install` if the project's package.json changed.Inspired and based off of https://gist.github.com/bumi/5706550

Make bundleing and npm installing easy

This repo has some handy handy hooks to run bundle or npm install whenever you:

  • git checkout a new branch with a different Gemfile or package.json
  • git pull a change to Gemfile or package.json

How can I has this!!?

  1. git clone https://gist.github.com/5869846.git hooks && cd hooks && chmod +x install
@thomir
thomir / svg2png.py
Created December 21, 2013 22:21
Various ways to convert SVG -> PNG
#!/usr/bin/env python
"""Convert an SVG file to a PNG file."""
from argparse import ArgumentParser
import subprocess
import os.path
def main():
@hayajo
hayajo / gist:8328903
Created January 9, 2014 03:22
vim-refでcodic
let g:ref_source_webdict_sites = {
\ 'codic': {
\ 'url': 'http://codic.jp/search?q=%s',
\ 'keyword_encoding': 'utf-8',
\ 'cache': 1
\ } }
function g:ref_source_webdict_sites.codic.filter(output)
return join( split(a:output, "\n")[15 :], "\n" )
endfunction
@hayajo
hayajo / Vagrantfile
Last active September 3, 2017 17:02
GitBucketのVagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
GITBUCKET_VERSION = "1.12"
HTTP_PORT = 8080
SSH_PORT = 29418
Vagrant.configure(2) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
@jedthehumanoid
jedthehumanoid / serialport-electron.md
Last active June 11, 2018 19:47
Build node serialport for electron

Building node-serialport for Electron on Windows

These instruction are for Windows, on my Linux installation(Fedora 21) everything works by just installing serialport with npm (I don't know why!).

These are the steps I did to build node serialport for electron (formerly atom-shell) for Windows. I am completely certain there is a better way to do it, but since I struggled with it for quite a while, here is a solution anyway.

You need some version of Visual studio installed, I have VS 2012 Express for Desktop.

@AndrewFromMelbourne
AndrewFromMelbourne / wifiscan.cxx
Last active December 20, 2022 02:41
wifi scanning code
// sudo apt-get install libiw-dev
//
// g++ -O3 -Wall wifiscan.cxx -o wifiscan -liw
#include <iwlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/time.h>
@gbaman
gbaman / HowToOTG.md
Last active May 16, 2024 20:10
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

@eerwitt
eerwitt / load_jpeg_with_tensorflow.py
Created January 31, 2016 05:52
Example loading multiple JPEG files with TensorFlow and make them available as Tensors with the shape [[R, G, B], ... ].
# Typical setup to include TensorFlow.
import tensorflow as tf
# Make a queue of file names including all the JPEG images files in the relative
# image directory.
filename_queue = tf.train.string_input_producer(
tf.train.match_filenames_once("./images/*.jpg"))
# Read an entire image file which is required since they're JPEGs, if the images
# are too large they could be split in advance to smaller files or use the Fixed