Skip to content

Instantly share code, notes, and snippets.

View narusemotoki's full-sized avatar

Motoki Naruse narusemotoki

View GitHub Profile
@narusemotoki
narusemotoki / powersave
Last active August 29, 2015 13:57 — forked from shunirr/cpufreq
none
@narusemotoki
narusemotoki / mode.go
Created May 2, 2014 04:51
This is my first time go without hello world.
package main
import (
"fmt"
"sort"
)
func mode(arr []int) int {
sort.Ints(arr)
var mode_count, mode_value, current_count, current_value int
@narusemotoki
narusemotoki / mode_test.go
Last active August 29, 2015 14:01
% for i in {1..100000}; do echo `od -An -N2 -l < /dev/urandom`; done > a
package main
import (
"fmt"
"strconv"
"bufio"
"io"
"os"
"testing"
)
irregular_verb = {
# AAA
'bet': 'bet',
'broadcast': 'broadcast',
'burst': 'burst',
'cast': 'cast',
'cost': 'cost',
'cut': 'cut',
'hit': 'hit',
'hurt': 'hurt',
$ cat /sys/devices/platform/sony-laptop/thermal_profiles
balanced silent performance
$ echo silent | sudo tee /sys/devices/platform/sony-laptop/thermal_control
sudo xrandr --newmode "2560x1440_30.00" 227.75 2560 2720 2992 3424 1440 1443 1448 1480 -hsync +vsync
sudo xrandr --addmode HDMI1 "2560x1440_30.00"
@narusemotoki
narusemotoki / execsqlite.sh
Created July 7, 2012 04:49
SQLite3のコマンドを直接実行します
#!/bin/sh
if [ 2 -ne $# ]; then
echo "引数にデータベース名 実行するSQL文を与えてください" 1>&2
exit 1
fi
sqlite3 $1<<EOF
.separator ,
$2
.exit
@narusemotoki
narusemotoki / notice.py
Created November 2, 2012 08:40
Linuxの通知を出すPythonスクリプト
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from optparse import OptionParser
import pynotify
def notify(app_name, title, message):
icon = 'dialog-information'
if app_name is None:
app_name = 'app_name'
if title is None:
@narusemotoki
narusemotoki / bothlist.py
Created November 4, 2012 03:06
Gitでコンフリクトしたファイルのファイル名のみを出力します
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import popen2
import re
def extractBothModifiedFileName():
r, w, e = popen2.popen3('git status')
for line in r:
if not line.find('both modified:') is -1:
yield re.split('[\t ]*', line.strip())[-1]
@narusemotoki
narusemotoki / .zshrc
Created November 4, 2012 03:08
Gitのコンフリクトしたファイルをemacsclientで開く
gbmec() {
git status | awk '/both modified:/{print $4}' | xargs emacsclient
}