Skip to content

Instantly share code, notes, and snippets.

View yuiseki's full-sized avatar
🍻
I want to drink

yuiseki yuiseki

🍻
I want to drink
View GitHub Profile
@yuiseki
yuiseki / cpufreqd.conf
Created July 20, 2013 18:39
/etc/cpufreqd.conf
# this is a comment
# see CPUFREQD.CONF(5) manpage for a complete reference
#
# Note: ondemand/conservative Profiles are disabled because
# they are not available on many platforms.
[General]
pidfile=/var/run/cpufreqd.pid
poll_interval=2
verbosity=4
# node v0.10.10
crypto = require "crypto"
secretKey = [
0xff, 0x03, 0x44, 0x89, 0xd6, 0xf8, 0x98, 0x21,
0x1f, 0xad, 0xaa, 0xda, 0x39, 0x9d, 0x3f, 0x8e,
0xbc, 0xd5, 0xa1, 0x00, 0xe1, 0x36, 0xfa, 0xcc,
0xe7, 0x48, 0x0a, 0x0e, 0x44, 0x1c, 0xf6, 0xaf,
]
secretKeyBuf = new Buffer(secretKey)
# node v0.10.10
crypto = require "crypto"
secretKey = [
0xff, 0x03, 0x44, 0x89, 0xd6, 0xf8, 0x98, 0x21,
0x1f, 0xad, 0xaa, 0xda, 0x39, 0x9d, 0x3f, 0x8e,
0xbc, 0xd5, 0xa1, 0x00, 0xe1, 0x36, 0xfa, 0xcc,
0xe7, 0x48, 0x0a, 0x0e, 0x44, 0x1c, 0xf6, 0xaf,
]
secretKeyBuf = new Buffer(secretKey)
# -*- coding:utf-8 -*-
import sys
import traceback
import datetime
from dateutil.parser import parse
import pytz
import json
import tweepy
uuid = require 'node-uuid'
hex1str = uuid.v4().replace(/-/g, "")
hex1buf = new Buffer(hex1str, "hex")
hex2str = uuid.v4().replace(/-/g, "")
hex2buf = new Buffer(hex2str, "hex")
result = new Array()
for i in [0...hex1buf.length]
r = hex1buf[i] ^ hex2buf[i]
result.push r
@yuiseki
yuiseki / gist:3689764
Created September 10, 2012 08:57
ALAssetsLibraryの取り扱い方法メモ
// AssetsLibrary.frameworkを追加し、
// .hで@property (nonatomic, strong) ALAssetsLibrary *library;とか宣言しておく
// 以下は、カメラロール内のある時点以降の画像をすべてUITableViewに表示しようとしている例
-(void)initAssetsLibrary
{
// TODO 保存時刻古い順でソートしたい → AssetsLibrary標準のAPIではできない
static dispatch_once_t pred = 0;
dispatch_once(&pred, ^{
self.library = [[ALAssetsLibrary alloc] init];
@yuiseki
yuiseki / gist:3338120
Created August 13, 2012 08:09
UIImageViewにタコメーター風の円弧描画 by CoreGraphics
// 与えられた正方形のImageViewと1から0のパーセント値に対して、タコメーター風の円弧を描くメソッド
- (void)drawArcToUIImageView:(UIImageView *)targetImageView withPercntage:(CGFloat)percnt
{
targetImageView.layer.needsDisplayOnBoundsChange=YES;
UIGraphicsBeginImageContext(targetImageView.frame.size);
struct CGContext *context = UIGraphicsGetCurrentContext();
CGPoint arcCenter = CGPointMake(targetImageView.frame.size.width/2, targetImageView.frame.size.height/2);
CGFloat outerRadius = (targetImageView.frame.size.width/2.0f)-1.0f;
CGFloat innerRadius = (targetImageView.frame.size.width/2.0f)-4.0f;
@yuiseki
yuiseki / ustreamdump.sh
Created June 12, 2012 13:56
Ustreamチャンネル名を指定するとrtmpdumpしてくれるシェルスクリプト ref: http://qiita.com/items/53194a24f0dff50ebdde
if [ $# -ne 1 ]; then
echo "usage: ustreamdump.sh channenName"
exit 1
fi
chid=$(wget http://api.ustream.tv/json/channel/${1}/getInfo?key=yourDevKey -q -O -|grep -Po '"id":[0-9]*?,'|grep -Po '[0-9]*')
if [ ! ${chid} ]; then
echo "api error, channelName: ${1}"
exit 1
fi
@yuiseki
yuiseki / gist:2893297
Created June 8, 2012 03:09
ustream録画rtmpdump
rtmpdump -v -r “rtmp://flash83.ustream.tv:1935/ustreamVideo/5883040/streams/live” -a "ustreamVideo/5883040" -y "streams/live" -f “LNX 10,1,58,3” -o `date +%s`.flv --stop 10
@yuiseki
yuiseki / EnableGoogleWebHistory.user.js
Created May 23, 2012 10:14
Userscript that enable using GoogleWebHistory in Opera and Firefox
// ==UserScript==
// @name EnableGoogleWebHistory
// @author mallowlabs
// @namespace http://mallowlabs.s206.xrea.com/
// @version 0.0.2
// @license public domain
// @description : Enable Google Web History
// @published 2007-01-05
// @modified 2006-01-05
// @include *