This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts an RGB color value to HSL. Conversion formula | |
* adapted from http://en.wikipedia.org/wiki/HSL_color_space. | |
* Assumes r, g, and b are contained in the set [0, 255] and | |
* returns h, s, and l in the set [0, 1]. | |
* | |
* @param Number r The red color value | |
* @param Number g The green color value | |
* @param Number b The blue color value | |
* @return Array The HSL representation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 下記を参考にしつつ作成 | |
# https://gist.github.com/matchy2/3956266 | |
# https://gist.github.com/saiten/1185755 | |
if [ $# -eq 1 ]; then | |
channel=$1 | |
case $1 in | |
r1) playpath='NetRadio_R1_flash@63346' ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/sstephenson/rbenv | |
# | |
# I'm using rbenv-build to install ruby | |
# https://github.com/sstephenson/ruby-build | |
cd ~/.rbenv/ | |
git pull | |
cd plugins/ruby-build/ | |
git pull | |
rbenv install 2.0.0-p0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Installing OpenCV python libs on mac to work with virtualenv | |
# OpenCV 2.4.3 | |
# Python 2.7.3 installed with brew | |
# assuming you have virtualenv, pip, and python installed via brew | |
# assuming $WORKON_HOME is set to something like ~/.virtualenvs | |
# using homebrew - make sure we're current | |
brew update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import appscript | |
def main(): | |
iterm_transparency = appscript.app('iTerm').current_terminal.current_session.transparency | |
iterm_transparency.set("0.9" if sys.argv[1] == '-' else "0.1") | |
if __name__ == '__main__': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import path, environ | |
import datetime | |
import json | |
import sys | |
appdata = environ['APPDATA'] | |
sublime_path = 'Sublime Text 2' | |
settings_path = 'Packages\User\Preferences.sublime-settings' | |
day_profile = 'Packages/Color Scheme - Default/Solarized (Light).tmTheme' | |
night_profile = 'Packages/Color Scheme - Default/Solarized (Dark).tmTheme' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: gpl-3.0 | |
redirect: https://observablehq.com/@d3/selection-join |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from http://stackoverflow.com/questions/4103773/efficient-way-of-having-a-function-only-execute-once-in-a-loop | |
from functools import wraps | |
def run_once(f): | |
"""Runs a function (successfully) only once. | |
The running can be reset by setting the `has_run` attribute to False | |
""" | |
@wraps(f) | |
def wrapper(*args, **kwargs): | |
if not wrapper.has_run: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MoonInfo = function(day, month, year) { | |
var n0 = parseInt( "0" ); | |
var f0 = parseFloat( "0.0" ); | |
var AG = f0; // Moon's age | |
var DI = f0; // Moon's distance in earth radii | |
var LA = f0; // Moon's ecliptic latitude | |
var LO = f0; // Moon's ecliptic longitude | |
var Phase = " "; | |
var Zodiac = " "; |