Skip to content

Instantly share code, notes, and snippets.

@msr1k
msr1k / Vcf2Text.rb
Created July 30, 2012 13:46
Decode vcf file (ARGV[0]).
# encoding : sjis
result = File.read( ARGV[0] ).gsub( /=(\n|[0-9A-F]{2})/ ){ |e| e.unpack("M")[0] }
puts result
@msr1k
msr1k / b2s.bat
Created January 25, 2013 09:40
Substitute windows path separator "\" with "/". Need `gem install clipboard`
ruby -e "require 'clipboard'; Clipboard.copy( Clipboard.paste.gsub( /\\/, '/' ) )"
@msr1k
msr1k / check_file_format.rb
Created June 29, 2015 10:37
Check file format such as Windows(CR+LF), Xnix(LF), Mac(LF+CR) or something.
# coding: cp932
Dir.glob( "**/*" ) do |f|
next if FileTest.directory? f
next if [
/^.git\// , /^RPC\// , /^Tools\// , /^TivaWare\// , /^.*~$/ , /^.*\.xlsx?$/ , /^.*\.docx?$/ , /^.*\.asta$/ ,
/^.*\.mm$/ , /^.*\.md$/ , /^.*\.lib$/ , /^.*\.pp$/ , /^.*\.obj$/ , /^.*\.mk$/ , /^.*\.dat$/ , /^.*\.out$/ ,
/^.*\.opt$/ , /^.*\.so$/ , /^.*\.dll$/ , /^.*\.exe$/ , /^.*\.bin$/ , /^.*\.xml$/ , /^.*\.png$/
].detect{ |re| f =~ re }
@msr1k
msr1k / git_log_parser.rb
Created September 17, 2015 04:24
Make git log result an array of hash object
# encoding: cp932
module Git
module Log
def self.get
# `git log --all --name-status`
`git log --all --date=iso --name-status`.encode( "cp932", "utf-8" )
end
#include <stdio.h>
char gData[2][2][2] = {
{
{ 1, 2 },
{ 3, 4 },
},
{
{ 5, 6 },
module ConvertToStandAloneHTML
EMPTY_LINE = /^\s*$/
#
# This is the only public method.
# Please use like this.
#
# Pack[ "Some HTML string to be converted." ]
def self.[] contents
@msr1k
msr1k / config.py
Last active November 21, 2017 10:22
keyhac my settings (Sort of replacement of xkeymacs)
import sys
import os
import datetime
import pyauto
from keyhac import *
def configure(keymap):

LLを利用した組み込み開発の効率化

LL(Lightweight Language)を開発に織り交ぜると 組み込み開発を加速できる!!

という可能性についての発表です

PWMモジュールの開発することになった場合

[alias]
graph = log --graph --date=format:\"%Y-%m-%d %H:%M\" --pretty=\"format:%C(yellow)%h %C(cyan)%ad %C(green)%an%Creset%C(red)%d %Creset%s\"
g = log --graph --date=format:\"%Y-%m-%d %H:%M\" --pretty=\"format:%C(yellow)%h %C(cyan)%ad %C(green)%an%Creset%C(red)%d %Creset%s\"
ga = log --graph --date=format:\"%Y-%m-%d %H:%M\" --pretty=\"format:%C(yellow)%h %C(cyan)%ad %C(green)%an%Creset%C(red)%d %Creset%s\" --all
d = diff
dc = diff --cached
dw = diff --color-words
dcw = diff --cached --color-words
s = status
su = status -uno
@msr1k
msr1k / test.html
Created July 12, 2016 01:00
Check JavaScript Message Queue Behavior: Particularly UI Event filtering timing
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<button id="a" onclick="A();">asdf</button>
<button id="b" onclick="B();">zxcv</button>
<script>
function C () {
for ( var i = 0; i < 65535; i += 2 ) {
i = i - 1;