Skip to content

Instantly share code, notes, and snippets.

@zunda
zunda / 140101-dropbox-dbeditor.txt
Last active August 29, 2015 13:56
DropboxのDB EditorがどういうIntentをやりとりしているか調べる
DropboxのDB EditorがどういうIntentをやりとりしているか調べる
DropBoxアプリから140101-dropbox-dbeditor.txtを…
- Share
- Favorite
- Delete
- More
- Rename
- Move
- Export
--- gtk+-3.10.7/gtk/gtkselection.c.orig 2014-01-27 12:40:26.000000000 -1000
+++ gtk+-3.10.7/gtk/gtkselection.c 2014-03-08 11:45:59.000000000 -1000
@@ -2294,7 +2294,7 @@
gulong selection_max_size;
if (event->requestor == NULL)
- return;
+ return FALSE;
if (initialize)
@zunda
zunda / homebrew-preserve-sourcetree.patch
Created March 10, 2014 03:45
A patch to Homebrew to preserve source tree
diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb
index 7037748..b10b97c 100644
--- a/Library/Homebrew/extend/fileutils.rb
+++ b/Library/Homebrew/extend/fileutils.rb
@@ -21,7 +21,7 @@ module FileUtils extend self
yield
ensure
cd prevd if prevd
- ignore_interrupts{ rm_r tempd } if tempd
+ $stderr.puts "Remove #{tempd} if everything went alright" if tempd
@zunda
zunda / itermvim.scpt
Last active August 29, 2015 13:57
An AppleScript to start vim inside iTerm
#!/usr/bin/osascript
on run argv
tell application "iTerm"
make new terminal
tell the last terminal
make new session
tell the last session
activate
exec command "vim " & argv
@zunda
zunda / checker.rb
Last active August 29, 2015 14:00
結城浩さん《スペーストーキー問題》 http://www.hyuki.com/codeiq/#c16 のデコーダ
require 'open-uri'
ARGF.each_line do |l|
input, output = l.chomp.split(/:/)
next if input =~ /[A-Z]/
actual = open("http://spacetalky.textfile.org/api.cgi?input=#{input}").read
if output != actual
puts "From #{input} expected #{output} but actually #{actual}"
end
sleep(0.5)
@zunda
zunda / gist:a053bf1df77f4801d3aa
Last active August 29, 2015 14:01
Nexus 5をUSB経由でつないでUSBテザリングを有効にした時のUbunt 13.10(!!)のdmesgの抜粋。リシアル番号は伏せてあります
usb 1-7: USB disconnect, device number 2
usb 1-7: new high-speed USB device number 3 using ehci-pci
usb 1-7: New USB device found, idVendor=18d1, idProduct=4ee4
usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-7: Product: Nexus 5
usb 1-7: Manufacturer: LGE
usb 1-7: SerialNumber: ****************
usbcore: registered new interface driver cdc_ether
rndis_host 1-7:1.0 usb0: register 'rndis_host' at usb-0000:00:1d.7-7, RNDIS device, d2:26:1e:09:98:f8
usbcore: registered new interface driver rndis_host
@zunda
zunda / tickets.rb
Created May 20, 2014 06:59
結城浩さん《チケットゴブル社の旅行プランを作れ!》 http://www.hyuki.com/codeiq/#c17 の回答
#!/usr/bin/ruby
# coding: utf-8
#
# time ruby answer/tickets.rb tickets.txt > answer-zunda.txt 2> consistent.txt
#
# real 0m5.222s
# user 0m5.198s
# sys 0m0.024s
# on 4 x Xeon 5160 3GHz
@zunda
zunda / serial-read.c
Created May 25, 2014 19:18
FTDI Friend経由でArduinoがシリアルポートに書いた出力を読んで時刻とともに表示する
/* http://www.cmrr.umn.edu/~strupp/serial.html */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <termios.h>
#include <signal.h>
#include <time.h>
@zunda
zunda / todo.md
Last active August 29, 2015 14:03
デスクトップマシンのUbuntuを更新する
@zunda
zunda / .bash_profile (Linux)
Last active August 29, 2015 14:04
プロンプトにGitのブランチ名を表示する
case "$TERM" in
xterm*|rxvt*)
if type __git_ps1 >/dev/null 2>&1; then
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUPSTREAM="auto"
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]\w\$(__git_ps1) \$ "
fi
;;
*)
;;