Skip to content

Instantly share code, notes, and snippets.

Avatar

Motoki Naruse narusemotoki

View GitHub Profile
View singlely_linked_list.rs
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 Mar 12, 2018
フィボナッチSQL
View fib.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
----
View HDMIでWQHD
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"
View gist:876dc73f1f35c98d3616
$ cat /sys/devices/platform/sony-laptop/thermal_profiles
balanced silent performance
$ echo silent | sudo tee /sys/devices/platform/sony-laptop/thermal_control
View 不規則動詞
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 Aug 29, 2015
% for i in {1..100000}; do echo `od -An -N2 -l < /dev/urandom`; done > a
View mode_test.go
package main
import (
"fmt"
"strconv"
"bufio"
"io"
"os"
"testing"
)
@narusemotoki
narusemotoki / mode.go
Created May 2, 2014
This is my first time go without hello world.
View mode.go
package main
import (
"fmt"
"sort"
)
func mode(arr []int) int {
sort.Ints(arr)
var mode_count, mode_value, current_count, current_value int
View vp11_setup_ubuntu.sh
#!/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 Dec 31, 2015
自分用のRaspberry Piのセットアップ用シェルスクリプト wget https://gist.github.com/narusemotoki/7958192/raw/4d609fc04d29ce48d1554f6aab977a644688e941/setuppi.sh; bash setuppi.sh
View 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