Skip to content

Instantly share code, notes, and snippets.

View sytrus-in-github's full-sized avatar

sytrus-in-github

View GitHub Profile
@sytrus-in-github
sytrus-in-github / json2js.py
Created April 25, 2016 21:56
A python script to transform JSON data file to JavaScript file so that the data can be loaded on local machine with <script> tag. A browser-independent workaround of local JSON file access problem.
import json
def json2js(jsonfilepath, functionname='getData'):
"""function converting json file to javascript file: json_data -> json_data.js
:param jsonfilepath: path to json file
:param functionname: name of javascript function which will return the data
:return None
@sytrus-in-github
sytrus-in-github / gsync
Last active November 3, 2016 19:18
A handy function for Git console to synchronize your local/remote repo. Usage: paste the function in file ~/.profile or ~/.bashrc. (or c:\Users\[your_name]\.bash_profile for Windows users)
function gsync() {
echo "*** Synchronizing current repo ***"
echo
echo "=== adding all ..."
git add .
echo
echo "=== committing all ..."
git commit -a -m "$1"
echo
echo "=== pulling ..."
@sytrus-in-github
sytrus-in-github / hackerRankInputTemplate.python
Last active April 25, 2017 21:18
template to get input from HackerRank problems for Python
# get number of tests and iterate through each tests
## Python 3
t = int(input().strip())
for _ in range(t):
## Python 2
t = int(input().strip())
for _ in range(t):

get package without installing with sudo

  1. get .deb package. (using e.g. apt-get download (package_name))
  2. unpack package with ar x *.deb
  3. unpack binary with tar xvzf data.tar.gz
  4. run usr/bin/(binary_name) and hope everything works :)

Summarized based on this answer in askubuntu

@sytrus-in-github
sytrus-in-github / ubuntu_install_notes.md
Last active November 22, 2017 22:18
Stuff that I have done to to have a nice running ubuntu 16.04 on my Dell laptop without the hassle of some strange behaviors.

Ubuntu 16.04 on Dell inspiron 15 7000 gaming

Ubuntu installation

  1. download Ubuntu system .iso file.
  2. prepare a usb key (better usb3 for speed, will be formatted but the storage space can be easily recovered)
  3. use rufus to unpack the iso file to the usb key
  4. branch the usb key to the computer
  5. restart, then press F12,
  6. turn off the secure boot option
@sytrus-in-github
sytrus-in-github / testColorfulQuiver3d.py
Created April 14, 2017 15:11
example script for matplotlib(2.0.0) quiver 3d custom coloring for each arrow
# tested with python 2 + matplotlib 2.0.0
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
def getMaxXYZ(vec3ds):
mx, my, mz = vec3ds[0]
for (x, y, z) in vec3ds:
mx, my, mz = (max(x, mx), max(y, my), max(z, mz))
@sytrus-in-github
sytrus-in-github / ROS_tuto_summary.md
Last active August 26, 2022 11:24
A cheat-sheet-like summary of the ROS tutorial

ROS tutorial summary

1 ROS environment management

1.1 check ROS environment

printenv | grep ROS

1.2 setup ROS environment (can be added to ~/.bash_profile for autosetup on each login)

source /opt/ros/<distro>/setup.bash (for Bash, don't use sth else like setup.sh!)

2 ROS (catkin) workspace management

2.1 create ROS (catkin) workspace

mkdir <path_to>/<workspace_name>/src