Skip to content

Instantly share code, notes, and snippets.

@syguer
syguer / gist:6788245
Last active December 24, 2015 10:59
Create directory when directory doesn't exist
if [ ! -d "DIR_NAME" ]; then mkdir "DIR_NAME";fi
@syguer
syguer / gist:7970193
Created December 15, 2013 07:57
Create ramdom String
var randobet = function(n) {
var a = 'abcdefghijklmnopqrstuvwxyz'
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ '0123456789';
a = a.split('');
var s = '';
for (var i = 0; i < n; i++) {
s += a[Math.floor(Math.random() * a.length)];
}
return s;
@syguer
syguer / gist:8795851
Created February 4, 2014 01:26
How to Control ELB with aws-sdk
require 'aws-sdk'
AWS.config(:access_key_id => ACCESS_KEY, :secret_access_key => SECRET_KEY, :ec2_endpoint => REGION, :elb_endpoint => ELB_REGION)
@elb_client = AWS::ELB.new().client
# show description
@elb_client.describe_load_balancers({load_balancer_names: ["ELB_NAME"]})
# get a lb
@syguer
syguer / gist:8838886
Created February 6, 2014 05:39
Create arbitrary size file
dd if=/dev/zero of=tempfile bs=1M count="SOME SIZE"
@syguer
syguer / gist:9405964
Created March 7, 2014 05:55
Remove all branch except master
git br | grep -v master | xargs git br -D
@syguer
syguer / get_access_token_from_trello.rb
Last active April 23, 2019 00:31
Get access token and secret from trello
require 'oauth'
consumer = OAuth::Consumer.new(
"CONSUMER_KEY",
"CONSUMER_SECRET",
{
site: "https://trello.com",
request_token_url: "https://trello.com/1/OAuthGetRequestToken",
authorize_url: "https://trello.com/1/OAuthAuthorizeToken",
access_token_url: "https://trello.com/1/OAuthGetAccessToken"

自己紹介

名前

Keisuke Izumiya
twitter @syguer

ご職業

元インフラエンジニアで今はアプリケーションエンジニア歴1年半です

デザインが素敵!と思う Web サービスひとつ

dropbox

@syguer
syguer / pre-commit
Created April 13, 2017 07:07
Avoid to commit development code
#!/bin/sh
RESULT=$(ag binding.pry app/* lib/* | wc -l | sed -e 's/ //g')
if test $RESULT -gt 0; then
echo "binding.pry exists! Aborting."
exit 1
fi
RESULT=$(ag console.log app/* lib/* | wc -l | sed -e 's/ //g')
package main
import (
"context"
"fmt"
"golang.org/x/oauth2"
"log"
)
func main() {
package main
import (
"context"
"encoding/json"
"fmt"
"golang.org/x/oauth2"
"io/ioutil"
)