Skip to content

Instantly share code, notes, and snippets.

View ryuichiueda's full-sized avatar

Ryuichi Ueda ryuichiueda

View GitHub Profile
@ryuichiueda
ryuichiueda / result.txt
Last active December 13, 2023 10:21
thread-fork test result
$ cargo run
・・・
1秒後 Child: ""
2秒後 Child: ""
3秒後 Child: ""
4秒後 Child: ""
5秒後 Parent { child: Pid(50794) }: "written"
5秒後 Child: ""
6秒後 Parent { child: Pid(50794) }: "written"
6秒後 Child: ""
@ryuichiueda
ryuichiueda / main.rs
Last active December 13, 2023 10:28
thread-fork test
use std::{time, thread};
use std::sync::{Arc, Mutex};
use std::time::Instant;
use nix::unistd;
use nix::unistd::ForkResult; //懺悔:これいらなかったです(cargo buildするとワーニング出ます。削ってください。)
fn main() {
let s = Arc::new(Mutex::new(String::new())); //Arcの中のMutexの中の文字列がデータ本体です。
let s1 = s.clone();
@ryuichiueda
ryuichiueda / .bash_profile
Created January 8, 2019 04:30
minimum bash_profile for Mac
export CLICOLOR=1
export LSCOLORS=DxGxcxdxCxegedabagacad
alias 'ls=ls -G'
[ -z "$PS1" ] && return
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
@ryuichiueda
ryuichiueda / my.terminal
Last active January 2, 2019 00:05
My terminal conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundAlphaInactive</key>
<real>0.5</real>
<key>BackgroundBlur</key>
<real>0.0</real>
<key>BackgroundBlurInactive</key>
<real>0.48512961647727271</real>
@ryuichiueda
ryuichiueda / update_eng_p22
Last active June 16, 2018 07:00
update_eng_p22
### OLD ###
cd /lib/firmware/brcm/
sudo wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.bin -O brcmfmac43430-sdio.bin
sudo wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.txt -O brcmfmac43430-sdio.txt
sudo reboot
### NEW ###
cd /lib/firmware/brcm/
use std::env;
fn main(){
let args: Vec<String> = env::args().collect();
let num:i32 = args[1].parse::<i32>().unwrap();
println!("{0: >width$ }","人", width= 2 + 2*num as usize);
for i in 0..num {
let width_left = (2*num - i*2 - 1) as usize;
let width_right = (i*4 + 4) as usize;
🍣: 🐟 🍚
echo 🐟🍚 → 🍣
🐟: 🐛
echo 🐛 → 🐟
🌾: 💩
echo 💩 → 🌾
🐛: 🌿
echo 🌿 → 🐛
🍚: 🌾
echo 🌾 → 🍚
@ryuichiueda
ryuichiueda / tex_to_plain.bash
Created February 18, 2017 15:33
tex to plain
#!/bin/bash
###文献リスト###
cat ../rpim_book.bbl |
grep '^\\bibitem' |
sed 's/bibitem/cite/' |
awk '{print "s/\\"$1"/["NR"]/g"}' > ./cite.sed
cat ../rpim_book.bbl |
sed 's/bibitem/cite/' |
@ryuichiueda
ryuichiueda / setup controller memo
Created September 26, 2016 08:16
設計製作論のコントローラのセットアップ
pi@raspberrypi ~ $ git clone https://github.com/ryuichiueda/RobotDesign3.git
pi@raspberrypi ~ $ cd RobotDesign3/
pi@raspberrypi ~/RobotDesign3 $ sudo make
...(ログはちゃんと見ましょう)
insserv: warning: script 'K01robot_design_3.sh' missing LSB tags and overrides
(↑このワーニングは無視でOK)
pi@raspberrypi ~/RobotDesign3 $ sudo reboot
(再度接続)
#確認方法1(プロセスが立ち上がっているか調査)
pi@raspberrypi ~ $ ps aux | grep robot | grep init