Skip to content

Instantly share code, notes, and snippets.

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

Slowhand Slowhand0309

🏠
Working from home
View GitHub Profile
@Slowhand0309
Slowhand0309 / C++ template samples
Last active August 29, 2015 14:23
C++ template samples
#include <boost/format.hpp>
#include <boost/shared_ptr.hpp>
#include <iostream>
#include <iterator>
#include <string>
#include <vector>
#include <list>
using namespace std;
@Slowhand0309
Slowhand0309 / bindForm.gs
Last active August 29, 2015 14:26
Google Apps Script Form SetDestination
/**
* スプレットシートとフォームの結び付け
*/
function bindForm() {
// フォーム取得
var formUrl = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var form = FormApp.openByUrl(formUrl);
// スプレットシート取得
@Slowhand0309
Slowhand0309 / Vagrantfile
Created October 3, 2015 08:54
template for my vagrant was
# -*- mode: ruby -*-
# vi: set ft=ruby :
AWS_ACCESS_KEY_ID = "XXXXXXXXXXXXX"
AWS_SECRET_KEY = "XXXXXXXXXXXXX"
Vagrant.configure(2) do |config|
config.vm.box = "dummy"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
config.vm.synced_folder ".", "/vagrant", disabled: true
@Slowhand0309
Slowhand0309 / git-hooks-msg.txt
Created October 24, 2015 08:33
git-hooks msg at server side
# hook file of the echo target
* pre-receive
* update
* post-update
# script
echo "update >>" >> up.log
echo $# >> up.log
echo $@ >> up.log
echo "--------------" >> up.log
@Slowhand0309
Slowhand0309 / update
Created October 24, 2015 09:14
git-hooks update for print info by push
#!/usr/bin/env ruby
refname = ARGV[0]
oldrev = ARGV[1]
newrev = ARGV[2]
puts "push info >> \n(#{refname}) (#{oldrev[0,6]}) (#{newrev[0,6]})"
sharevs = `git rev-list #{oldrev[0,6]}..#{newrev[0,6]}`.split("\n")
sharevs.each do |rev|
@Slowhand0309
Slowhand0309 / install_test_mac.sh
Last active July 27, 2019 05:29
[Install googletest for cmake] #Script
#!/bin/sh
echo "make directory build"
mkdir build
cd build
cmake ..
make
echo "copy header and library"
sudo cp -r ../googletest/include/gtest /usr/local/include/
@Slowhand0309
Slowhand0309 / gist:425e24a5cd01b5a0d0a6
Created January 31, 2016 08:03
Search the defined location for extended method. (ruby)
ex)
irb
2.1.0 :001 > require 'active_support'
=> true
2.1.0 :002 > cahce = ActiveSupport::Cache::MemoryStore.new
=> <#ActiveSupport::Cache::MemoryStore entries=0, size=0, options={}>
2.1.0 :006 > cahce.method(:blank?).source_location
=> ["/Users/xxxx/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.5.1/lib/active_support/core_ext/object/blank.rb", 16]
2.1.0 :007 > cahce.method(:blank?).owner
=> Object
@Slowhand0309
Slowhand0309 / canvas_loupe.js
Last active August 31, 2018 14:46
Loupe on html5 canvas.
/**
* canvas_loupe.js
*/
var loupe = {
x: 0, // Current x.
y: 0, // Current y.
w: 0, // Image width.
h: 0, // Image height.
@Slowhand0309
Slowhand0309 / get_battery.sh
Created July 17, 2016 14:37
Get battery percent of mouse
#!/usr/bin/env bash
# Mouse
ioreg -c BNBMouseDevice | grep BatteryPercent | grep -v { | sed 's/[^[:digit:]]//g'
# Keyboard
ioreg -c AppleBluetoothHIDKeyboard | grep BatteryPercent | grep -v { | sed 's/[^[:digit:]]//g'
@Slowhand0309
Slowhand0309 / tree_ignore_example
Last active July 27, 2019 05:29
[Tree command with ignore pattern] #Command
tree -a -I '.git|node_modules|.bundle|vendor|.DS_Store'