Skip to content

Instantly share code, notes, and snippets.

View tizee's full-sized avatar
🙏
Work and persevere

Jeff Chiang tizee

🙏
Work and persevere
  • Earth, Solar system
View GitHub Profile
nor $1, $0, $0; #$1 = ~ ($0 | $0) = FFFF_FFFF
sltu $2, $0, $1; #$2 = $0 < $1 ? 1 : 0 = 0000_0001
add $3, $2, $2; #$3 = $2 + $2 = 0000_0002
add $4, $3, $2; #$4 = $3 + $2 = 0000_0003
add $5, $4, $3; #$5 = $4 + $3 = 0000_0005
add $6, $5, $3; #$6 = $5 + $3 = 0000_0007
sllv $7, $6, $2; #$7 = $6 << $2 = 0000_000E
add $9, $5, $6; #$9 = $5 + $6 = 0000_000C
sllv $8, $6, $9; #$8 = $6 << $9 = 0000_7000
xor $9, $1, $8; #$9 = $1 ^ $8 = FFFF_8FFF
@tizee
tizee / osexpp.c
Created June 18, 2018 09:41
os_exp1
SYSCALL_DEFINE3(setnice,pid_t,pid,int,flag,int,nicevalue)
{
int errono = 0;
struct pid * temp_pid=find_get_pid(pid);
struct task_struct *p=pid_task(temp_pid,PIDTYPE_PID);
if(p->pid != pid)
{
errono=-EFAULT;
return errono;
}
@tizee
tizee / run jupyter command
Last active December 26, 2018 08:24
run jupyer notebook in the background
nohup jupyter notebook --allow-root > error.log 2>&1 & echo $! > notebook_pid.txt
# add --no-browser if run as a jupyter notebook server
nohup jupyter notebook --allow-root --no-browser> error.log 2>&1 & echo $! > notebook_pid.txt
# reference https://stackoverflow.com/questions/17385794/how-to-get-the-process-id-to-kill-a-nohup-process
@tizee
tizee / gist:8883aa98624ade0c80aa26be2b028564
Created January 25, 2019 06:15 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@tizee
tizee / find-tutorial.sh
Last active August 20, 2020 02:22
Linux/Unix find command examples
# Usage: combined with rm / cp / xargs / ... using pipe
# Find files with specific name e.g. foo and print them
find . -name "foo" -print
# Find files with specific types e.g. directories
find . -type d -print
# Find files under specific path e.g ~/foo/
find . -path "~/foo/*" -print
@tizee
tizee / nohup.md
Created March 3, 2020 05:56
nohup command

Just like another script for jupyter notebook. bash nohup rvm install 2.6.5 >./info.out 2>./err.out &

@tizee
tizee / example.sh
Created March 4, 2020 14:04
find files with patterns
# -r recursively
# -n line number
# -w match whole word
# -e perl pattern
grep -rnw '\path\to\directory' -e 'perl_pattern'
# good question: https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux
@tizee
tizee / gist:eaadc770e30a1b750936b8ff15769cad
Created May 19, 2020 08:28
Running DevDocs on local/remote server as a service
[Unit]
Description=devdocs in raspberry pi
[Service]
Type=simple
SyslogIdentifier=devdocs-pi
User=root
WorkingDirectory=/home/pi/devdocs/
PIDFile=/home/pi/devdocs.pid
Environment=BUNDLE_GEMFILE=/home/pi/devdocs/Gemfile
@tizee
tizee / example.sh
Created May 19, 2020 08:55
find files containing specific text
# reference https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux
## 1. grep
grep -rnw '/path/to/somewhere/' -e 'pattern'
## 2. ack
ack 'text-to-find-here'
## 3. grep with find
find . -name '*.js' -exec grep -i 'string to search for' {} \; -print
# or
find . -type f -exec grep -l "Apache License" {} \;
@tizee
tizee / tools.sh
Created May 19, 2020 15:16
CLI clipboard tools on different OS
# macos
pbcopy < file.txt
# win
clip < file.txt
# linux
# install xclip
xclip -sel clip < file.txt