Skip to content

Instantly share code, notes, and snippets.

Yuichi Tateno (secon) hotchpotch

Block or report user

Report or block hotchpotch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hotchpotch
hotchpotch / switch_im.json
Created Aug 15, 2018
~/.config/karabiner/assets/complex_modification/switch_im.json
View switch_im.json
{
"title": "Switch IM",
"rules": [
{
"description": "right_control -> CN",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "right_control"
@hotchpotch
hotchpotch / support_nano_32K_mbed_5.diff
Created Sep 27, 2016
BLE nano V1.5 support mbed OS 5
View support_nano_32K_mbed_5.diff
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"]
View .minttyrc
BoldAsFont=no
CursorType=block
Font=Ricty Diminished
FontHeight=14
WindowShortcuts=no
Transparency=off
FontSmoothing=full
Term=xterm-256color
Locale=ja_JP
Charset=UTF-8
@hotchpotch
hotchpotch / file0.txt
Last active Aug 29, 2015
A/D コンバータの MCP3002, MCP3208 を raspberry pi 上の Ruby から扱う ref: http://qiita.com/hotchpotch/items/5c47ae210a7a8e9fd6d1
View file0.txt
require 'spi_mcp'
mcp = MCP3208.new
val = mcp.channel(0)
puts val # 0 ~ 4095
View reinstall_ruby_ext.sh
TARGET_EXT=readline; cd ~/.rbenv/sources; for x in *; do cd ~/.rbenv/sources/${x}/ruby-${x}; pwd; rm -vf .ext/*/$TARGET_EXT.bundle ext/$TARGET_EXT/Makefile ext/$TARGET_EXT/*.o; make install-ext; done
View ibook_copy_clean.rb
#!/usr/bin/ruby
# encoding: UTF-8
if `pbpaste`.match(/“(.*?)”/m)
target = $1.chomp
require 'open3'
puts target
Open3.popen3( 'pbcopy' ) {|input, _, _| input << target }
end
View fizzbuzz.swift
extension Int {
func fizzbuzz() -> String {
switch (self % 3 == 0, self % 5 == 0) {
case (true, false):
return "Fizz"
case (false, true):
return "Buzz"
case (true, true):
return "FizzBuzz"
default:
@hotchpotch
hotchpotch / glitch_motion.rb
Created Dec 12, 2013
glitch in RubyMotion (memo)
View glitch_motion.rb
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 Dec 14, 2015
elasticsearch homebrew formula 0.90.0.Beta1
View elasticsearch.rb
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?
View msgpack-unpack
#!/usr/bin/env ruby
require 'msgpack'
require 'pp'
while gets
line = $_.strip
begin
pp MessagePack.unpack(line)
rescue EOFError => e
You can’t perform that action at this time.