Skip to content

Instantly share code, notes, and snippets.

View tkmru's full-sized avatar
💭
🍣 💰 🍖 🍶

@tkmru tkmru

💭
🍣 💰 🍖 🍶
View GitHub Profile
@yono
yono / extractword.py
Created January 8, 2010 04:52
MeCabの出力結果を基に接頭辞や接尾辞を連結する -> http://github.com/yono/py-extractword
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
import MeCab
class Word(object):
def __init__(self,surface,feature):
self.surface = surface
self.feature = feature
@runemadsen
runemadsen / description.markdown
Created September 26, 2011 15:23
Reverse polymorphic associations in Rails

Polymorphic Associations reversed

It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media

This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.

@emachnic
emachnic / default.rb
Created December 1, 2011 15:29
Chef recipe to write redis.yml on Engine Yard Cloud
# ey-cloud-recipes/cookbooks/redis-yml/recipes/default.rb
if ['app_master', 'app'].include?(node[:instance_role])
redis_instance = node['utility_instances'].find { |instance| instance['name'] == 'redis' }
if redis_instance
node[:applications].each do |app, data|
template "/data/#{app}/shared/config/redis.yml"do
source 'redis.yml.erb'
owner node[:owner_name]
@pubis
pubis / redis.rb
Created December 11, 2011 09:07
Redis config and initialization for rails
#config/initializers/redis.rb
require 'redis'
require 'redis/objects'
REDIS_CONFIG = YAML.load( File.open( Rails.root.join("config/redis.yml") ) ).symbolize_keys
dflt = REDIS_CONFIG[:default].symbolize_keys
cnfg = dflt.merge(REDIS_CONFIG[Rails.env.to_sym].symbolize_keys) if REDIS_CONFIG[Rails.env.to_sym]
$redis = Redis.new(cnfg)
Redis::Objects.redis = $redis
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 7, 2024 07:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

Docutilsについて

DocutilsでHTMLを生成してみよう

  • 2012.09.16
    • PyCon JP 2012
@yaakaito
yaakaito / gist:4601150
Last active December 17, 2019 06:58
「Githubのせいで留年しました」
参考:http://www.itmedia.co.jp/news/articles/1205/18/news091.html
「わたし、Githubのせいで留年したんです」――こう話すのは、都内の私立大学に通うHogeさん(21・仮名)。Githubのほか、Bitbucket、SourceForge、stackoverflowなど複数のツールを使ってきたHogeさん。今年4月、Hogeさんにとって2回目の大学2年生が始まった。
HogeさんがGithubを始めたのは大学に入学した2010年。それまでもstackoverflowなどのSNSを利用していたが「stackoverflowは外人とのディスカッション中心で、Githubはライブラリの公開がメイン」と、環境の変化に合わせて使用するSNSを変えてきた。
stackoverflowではコメントなどを通じた外人とのコミュニケーションが中心だったが、Githubでは「新しいのプッシュされてる、アップデート決定」「あのIssue、今日なんか進捗あった?」「このPullRequestマージしたらごはん食べよう」「今夜ハッカソンやるけど誰か来たい人!」――など、自分と直接関係がない情報でも、リアルタイムに更新される全てのフィードが気になった。
どんな時も、Githubを開けば必ず誰かが何かをCommitしている。その面白さに夢中になり、気付けば毎日、暇さえあればコミットログを追うようになっていた。自分でも多い日には1日に100回以上CommitをPushし、満員電車でPCが開けず、Wifiにつながりにくい時などは、Pushがうまくできないことにいら立った。
@jordanorelli
jordanorelli / gif_example.pde
Created February 20, 2013 02:38
make an animated gif with Processing
import gifAnimation.*;
GifMaker gifExport;
int frames = 0;
int totalFrames = 120;
public void setup() {
smooth();
size(400, 400);
@jordanorelli
jordanorelli / shapes.pde
Created March 10, 2013 20:57
3d animated gif with processing
import gifAnimation.*;
GifMaker gifExport;
int frames = 0;
int totalFrames = 180;
void setup() {
smooth();
size(900, 300, P3D);
ortho();
@tprynn
tprynn / csaw2013recon.md
Last active December 23, 2015 18:19
CSAW CTF 2013 Recon Write-up

CSAW CTF 2013 Recon Write-up -- WildcatSec

Recon 1 - Alexander Taylor

I was totally stuck on this one until we recieved the hint "Bro, do you even PNG?" Immediately we know that the key or a hint will be hidden somewhere in an image. First step for recon is always check the judges page, which usually gives you some lead or info. Download the relevant picture (ataylor.png). Then check exif data:

Tanner:csaw $ exiftool ataylor.png
ExifTool Version Number         : 9.29
File Name                       : ataylor.png
Directory : .