Skip to content

Instantly share code, notes, and snippets.

View 4noha's full-sized avatar

Shinonome.Hatsuri 4noha

View GitHub Profile
sudo bluetoothctl
> scan on
> scan off
> exit
sudo apt-get install dbus
wget https://raw.githubusercontent.com/mk-fg/fgtk/master/bt-pan
chmod +x bt-pan
# sudo apt-get install python-pip
@4noha
4noha / !3:dim_to_aqm1248a.rb
Last active February 1, 2018 07:10
dim dot graphic data binarization toolkit for AQM1248A
#######################################
## test draw 1dimmantion(6144)
#######################################
def pic_1dimput(pic, width=128, height=48)
for i in 0..height-1 do
rawdim = []
for j in 0..width-1 do
rawdim << ( (pic[ i*128 + j ] != 0) ? "$" : " " )
end
rawdim << "\n"
# ruby input_test.c
require 'io/console'
puts "Angle( C-c: exit )\n1. 0°\n2. 90°\n3. 180°"
while c = STDIN.getch
exit if c == ?\C-c
print c
require 'io/console'
puts "Angle( C-c: exit )\n1. 0°\n2. 90°\n3. 180°"
while c = STDIN.getch
exit if c == ?\C-c
if c == "1" || c == "2" || c == "3"
print c
puts "\nAngle( C-c: exit )\n1. 0°\n2. 90°\n3. 180°"
# ライブラリのインストール
# gem install serialport
require 'io/console'
require 'serialport'
sp = SerialPort.new('/dev/ttyS0', 9600, 8, 1, 0) # device, rate, data, stop, parity
puts "Angle( C-c: exit )\n1. 0°\n2. 90°\n3. 180°"
@4noha
4noha / homehub.service
Created April 8, 2018 06:07
for systemd
[Unit]
Description=homehub
[Service]
Type=simple
WorkingDirectory=/home/nokkii/works/homehub
ExecStart=/usr/local/opt/rbenv/shims/ruby /home/nokkii/works/homehub/app.rb
ExecStop=pkill -KILL -f "ruby app.rb"
ExecReload=pkill -KILL -f "ruby app.rb" && /usr/local/opt/rbenv/shims/ruby /home/nokkii/works/homehub/app.rb
TimeoutStopSec=5
sudo apt install nginx
sudo apt-get -y install dnsmasq
sudo emacs /etc/dnsmasq.conf
# # Disables /etc/resolv.conf
# no-resolv
# no-poll
# # Never forward plain names (without a dot or domain part)
# domain-needed
# # Never forward addresses in the non-routed address spaces.
require 'ftdi'
@ctx = Ftdi::Context.new
@ctx.usb_open_desc(0x0403, 0x6001,nil,"00000000")
@ctx.set_bitmode(0x3f, :bitbang)
@ctx.read_pins
@ctx.write_data [0x03]
sudo emacs /etc/network/interfaces
>
auto eth0
iface eth0 inet dhcp
allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
address 192.168.1.1
# install nvm for system-wide
sudo apt install git
cd /usr/local
git clone git://github.com/creationix/nvm.git nvm
. /usr/local/nvm/nvm.sh
sudo emacs /etc/profile.d/nvm.sh
>
source /usr/local/nvm/nvm.sh
>