Skip to content

Instantly share code, notes, and snippets.

View narusemotoki's full-sized avatar

Motoki Naruse narusemotoki

View GitHub Profile
use std::cell::RefCell;
use std::rc::Rc;
type Link<T> = Rc<RefCell<Node<T>>>;
pub struct Node<T: Copy> {
value: T,
next: Option<Link<T>>,
}
@narusemotoki
narusemotoki / fib.sql
Created March 12, 2018 08:48
フィボナッチSQL
WITH RECURSIVE fib (m, n) AS (
SELECT 1, 1
UNION ALL
SELECT n, m + n FROM fib
)
SELECT m FROM fib
LIMIT 10
;
m
----
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"
$ cat /sys/devices/platform/sony-laptop/thermal_profiles
balanced silent performance
$ echo silent | sudo tee /sys/devices/platform/sony-laptop/thermal_control
irregular_verb = {
# AAA
'bet': 'bet',
'broadcast': 'broadcast',
'burst': 'burst',
'cast': 'cast',
'cost': 'cost',
'cut': 'cut',
'hit': 'hit',
'hurt': 'hurt',
@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"
)
@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 / powersave
Last active August 29, 2015 13:57 — forked from shunirr/cpufreq
none
#!/bin/bash
cd ~
echo "apt-getを使用するためにパスワードを入力"
sudo apt-get update
sudo apt-get install -y zsh
echo "シェルをzshに変更するためにパスワードを入力"
chsh -s /bin/zsh
@narusemotoki
narusemotoki / setuppi.sh
Last active December 31, 2015 08:08
自分用のRaspberry Piのセットアップ用シェルスクリプト wget https://gist.github.com/narusemotoki/7958192/raw/4d609fc04d29ce48d1554f6aab977a644688e941/setuppi.sh; bash setuppi.sh
#!/bin/bash
# sudo dd if=~/Downloads/2013-09-25-wheezy-raspbian.img of=/dev/sdb
# sudo raspi-config
echo -n "What's this ip address?: "
read IP_ADDRESS
sudo apt-get update
sudo apt-get install -y libsqlite3-dev libssl-dev python-pip emacs
sudo pip install virtualenv virtualenvwrapper