Skip to content

Instantly share code, notes, and snippets.

View hotchpotch's full-sized avatar
🏠
Working from home

Yuichi Tateno (secon) hotchpotch

🏠
Working from home
View GitHub Profile
@hotchpotch
hotchpotch / .pryrc
Created March 5, 2012 13:26
pry clipboard copy utility
def pbcopy(str)
IO.popen('pbcopy', 'r+') {|io| io.puts str }
output.puts "-- Copy to clipboard --\n#{str}"
end
Pry.config.commands.command "hiscopy", "History copy to clipboard" do |n|
pbcopy _pry_.input_array[n ? n.to_i : -1]
end
Pry.config.commands.command "copy", "Copy to clipboard" do |str|
@hotchpotch
hotchpotch / switch_im.json
Created August 15, 2018 04:33
~/.config/karabiner/assets/complex_modification/switch_im.json
{
"title": "Switch IM",
"rules": [
{
"description": "right_control -> CN",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "right_control"
#!/bin/bash
git --no-pager grep "$@"
git --no-pager submodule --quiet foreach 'git grep --full-name -n ' "$@" '; true'
@hotchpotch
hotchpotch / support_nano_32K_mbed_5.diff
Created September 27, 2016 07:51
BLE nano V1.5 support mbed OS 5
diff --git a/hal/targets.json b/hal/targets.json
index 7ce4ad8..3e8969c 100644
--- a/hal/targets.json
+++ b/hal/targets.json
@@ -1464,16 +1464,18 @@
"macros_add": ["TARGET_RBLAB_NRF51822"]
},
"RBLAB_BLENANO": {
- "inherits": ["MCU_NRF51_16K"],
- "release_versions": ["2"]
BoldAsFont=no
CursorType=block
Font=Ricty Diminished
FontHeight=14
WindowShortcuts=no
Transparency=off
FontSmoothing=full
Term=xterm-256color
Locale=ja_JP
Charset=UTF-8
// ==UserScript==
// @name drag & drop fotolife uploader
// @namespace http://rails2u.com/*
// @description フォトライフでローカルファイルから drag & drop でファイルアップロード (HTML5 File API 対応ブラウザのみ)
// @include http://f.hatena.ne.jp/*/up*
// ==/UserScript==
var upForm = document.getElementById('upload');
@hotchpotch
hotchpotch / glitch_motion.rb
Created December 12, 2013 11:11
glitch in RubyMotion (memo)
def glitchnize(image_data)
bytes = image_data.bytes
length = image_data.length
d = Pointer.new(:uchar, length)
length.times do |i|
c = bytes[i]
if c == 42 && rand > 0.8
d[i] = rand(255)
else
d[i] = c
@hotchpotch
hotchpotch / elasticsearch.rb
Last active December 14, 2015 18:59
elasticsearch homebrew formula 0.90.0.Beta1
require 'formula'
class Elasticsearch < Formula
homepage 'http://www.elasticsearch.org'
url 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.Beta1.tar.gz'
sha1 'b2c7381368f8df57d10ce5fa18f55876d5d8969d'
head 'https://github.com/elasticsearch/elasticsearch.git'
depends_on 'maven' if build.head?
#!/usr/bin/env ruby
require 'msgpack'
require 'pp'
while gets
line = $_.strip
begin
pp MessagePack.unpack(line)
rescue EOFError => e
#!/usr/bin/env ruby
require 'capybara-webkit' # '~> 0.14.0'
require 'optparse'
require 'cgi'
options = {}
OptionParser.new do |opt_parser|
opt_parser.on('-O filename') {|value| options[:filename] = value }