Skip to content

Instantly share code, notes, and snippets.

Avatar

nouyang nouyang

View GitHub Profile
View UR.script
# Other possibilities
# e.g. Used for RG2 gripper
def olmia():
#force0 = 5
#width0 = 0
#force1 = 5
#width1 = 1100
#force2 = 40
#width2 = 0
@nouyang
nouyang / minimal_arucotag.py
Created Apr 25, 2020
Read arucotag using opencv in python, convert to euler angle, print to shell and write to file
View minimal_arucotag.py
'''
Date: 24 April 2020
Author: nouyang
Example for reading (multiple) aruco tag.
The code outputs pose estimate to the shell (or to the file).
Motivation: The openCV documentation is oriented at C++, so it may be difficult to
translate to Python. This is a simple example that reads multiple tags, converts
rotation to Euler, and prints to the commandline. I also explain how to obtain camera
@nouyang
nouyang / vtt2text.py
Created Apr 7, 2020 — forked from glasslion/vtt2text.py
This script convert youtube subtitle file(vtt) to plain text.
View vtt2text.py
"""
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl --skip-download --convert-subs vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.
@nouyang
nouyang / terminalTimer.sh
Last active Jul 24, 2019 — forked from tir38/terminalTimer.sh
in-terminal timer shell script
View terminalTimer.sh
# script to create timer in terminal
# Jason Atwood
# 2013/6/22
# Nouyang -- added large font, send-notify popup, gnome-terminal resize, and play wav file
# 2019
#!/bin/sh
# start up
#echo "starting timer script ..."
@nouyang
nouyang / 2019-01-30 20:34:12_arucotagData.csv
Created Mar 5, 2019
Files for 6-axis force torque sensor
View 2019-01-30 20:34:12_arucotagData.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 5 columns, instead of 4. in line 2.
Arucotag time, tag1 xyz, tag2 xyz, tag1 rollpitchyaw (xyz), tag2 -- xyz zerod averaged; 1.4325604438781738; -0.04961893824233008; -0.05359939423137295; -0.04982387644324944; -0.05038360130221645; -0.04640478914072482; -0.050179964932310084; 2.8118697239913235; -8.772199918827821; -9.82776223299835; 2.7892837261660275; 9.890234153377573; -14.972194520722148; -0.05000126977227327; -0.05000209168604888; -0.05000192068777976; 2.8005767250786757; 0.5590171172748759; -12.399978376860249
Arucotag time, tag1 xyz, tag2 xyz, tag1 rollpitchyaw (xyz), tag2 -- xyz zerod averaged; 1.4791462421417236; -0.04959811047099668; -0.053596665003502485; -0.04976573979042518; -0.05038360130221645; -0.04640478914072482; -0.050179964932310084; 4.738171612374154; -15.070717763088878; -22.51421969502433; 4.756004713612519; 15.445164648243166; -30.858389788111364; -0.04999085588660657; -0.05000072707211366; -0.04997285236136763; 4.747088162993337; 0.18722344257714418; -26.686304741567845
Arucotag time, tag1 xyz, tag2 xyz, tag1 rollpitchy
@nouyang
nouyang / test.sh
Created Jan 31, 2019
thinkpad nub (trackpoint) settings
View test.sh
# https://askubuntu.com/questions/37824/what-is-the-best-way-to-configure-a-thinkpads-trackpoint
echo 200 | sudo tee /sys/devices/platform/i8042/serio1/serio2/sensitivity
echo 200 | sudo tee /sys/devices/platform/i8042/serio1/serio2/speed
@nouyang
nouyang / fill_pdfrw2.py
Last active Jan 2, 2019
sign pdf on ubuntu while retaining fillable fields (using python)
View fill_pdfrw2.py
#! /usr/bin/python
import os
import pdfrw
INVOICE_TEMPLATE_PATH = 'delay.pdf'
INVOICE_OUTPUT_PATH = 'delay_pdfrw2.pdf'
@nouyang
nouyang / Commands
Last active Jan 3, 2019
Ubuntu 18.10 on Thinkapd X1 Yoga Gen 2
View Commands
* Brightness keys don't work. Instead
rui@chaiX1YG2:~$ xrandr --output eDP-1 --brightness 0.8
As a temp solutions, I created keyboard shortcuts for 0.8 (super-f6) and 0.3 (supers-f5) settings, using
gnome-terminal -e "sh \home\rui\brightdown.sh" (may require chmod +x)
Via the settings GUI -> add a custom shortcut
* Suspend doesn't seem to work
systemctl suspend -i
@nouyang
nouyang / 0_README.md
Last active Dec 30, 2018
Automating Mal-Lys form submission
View 0_README.md

To use

(install python)

$ pip install requests
$ python robo_submit.py

Created by nouyang for jbaek

View vimtips.vim
:s/#\([a-z]\)/# \1/g
" replaces:
" #test
" with:
" # test
# to comply with pep8 (inserts space)