Skip to content

Instantly share code, notes, and snippets.

View phongvh's full-sized avatar

Phong phongvh

  • https://hololab.vn
  • Ho Chi Minh City
View GitHub Profile

g: move => + z + 1 => move up 1 meter
s: scale => + x/y/z r: rotate
a: select all / alt a: deselect all
z: choose view mode
tab: edit mode / 3 to select face / e to extrude / i to inset / b to bevel
m: move to new collection
A: add
Cmd l: Link option
Shift + 2 fingers: move view port

@phongvh
phongvh / parallel.js
Created October 11, 2021 07:43
Promise.all & async.parallel
import async from 'async';
const ap = () => {
async.parallel([
(cb) => {
setTimeout(() => {
console.log(2)
cb(2, 2);
}, 2000);
},
@phongvh
phongvh / rosweb_launch.sh
Last active September 25, 2021 11:17
rosweb_launch
apt install ros-melodic-rosbridge-server
apt install ros-melodic-tf2-web-republisher
roslaunch turtlebot3_gazebo turtlebot3_world.launch
roslaunch turtlebot3_slam turtlebot3_slam.launch
roslaunch rosbridge_server rosbridge_websocket.launch
rosrun tf2_web_republisher tf2_web_republisher
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Getting scancode from a PS/2 keyboard

Keyboard is a basic input device containing a organised matrix switches in them.The keyboard is a basic input device connected to the CPU through a PS/2 or USB or a serial port.The data sent by the keyboard is received by a micro-controller chip(8042 or 8048) on the System's motherborad.This micro-controller is the chip which controls and manages the incomming and outgoing data of the keyboard.A PS/2 mouse is also controlled by the same micro-controller(i.e; 8042 or 8048).

How it works???

When a key is pressed , the keyboard sends a signal to the micro controller telling that a key was pressed .Then the controller fires an IRQ 1 to the Programmable Interrupt Controller and keeps the data ready in the (0x60 port) buffer which then will be read by the operating system.

Job of the Operating System :

The operating system must collect the data from the port "0x60"(Keyboard Data port) whenever an IRQ 1 is fired.This interrupt is fired by the micro-cont

#!/bin/sh
echo "Create a 4 gigabyte swapfile"
sudo fallocate -l 4G /swapfile
echo "Secure the swapfile by restricting access to root"
sudo chmod 600 /swapfile
echo "Mark the file as a swap space"
sudo mkswap /swapfile
Recover lost partitions
Boot with Ubuntu, Go to Software & Update, choose Universe source in Ubuntu Software tab
Open Terminal: sudo apt update && sudo apt install testdisk
Select No Log.
Select the disk drive you want to recover, e.g. /dev/sdc.
Select your partition table type. Usually it's Intel.
Select Analyse and Quick Search.
# Camera 1 of these
sudo apt install guvcview
sudo apt install cheese
sudo apt install motion (sudo motion / sudo service motion start | http://localhost:8080)
# OpenVPN
sudo apt install openvpn
sudo openvpn --config ~/client.ovpn
# X11VNC
@phongvh
phongvh / tmux.sh
Last active November 6, 2019 07:57
#!/bin/sh
#
# Setup a work space called `work` with two windows
# https://blog.damonkelley.me/2016/09/07/tmux-send-keys/
# bind -p to show C-m, C-j
# https://tmuxcheatsheet.com/
# tmux a
# tmux ls
# tmux kill-ses -t objd
# Ctrl+b d
python3 -c 'import tensorflow as tf; print(tf.__version__)' #check version