Skip to content

Instantly share code, notes, and snippets.

View bqhuyy's full-sized avatar

Huy Q. Bui bqhuyy

View GitHub Profile
@bqhuyy
bqhuyy / string_converter.cpp
Created November 30, 2023 04:12 — forked from creatorlxd/string_converter.cpp
string to wstring and wstring to string
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
wstring StringToWString(const string& str)
{
wstring wstr;
size_t size;
@bqhuyy
bqhuyy / gist:f1d9d3808e6ffd0f2121113ef53aaca4
Created July 24, 2023 01:40 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@bqhuyy
bqhuyy / archive.ps1
Created April 5, 2023 08:07 — forked from KyleMit/archive.ps1
Execute Powershell Script on Right Click in Windows Explorer
$path = $args[0]
Add-Type -AssemblyName PresentationFramework
[System.Windows.MessageBox]::Show("Hello $path")
@bqhuyy
bqhuyy / biosuuid.cpp
Created April 4, 2023 02:40 — forked from neacsum/biosuuid.cpp
How to Get the BIOS UUID
#include <windows.h>
#include <sysinfoapi.h>
#include "biosuuid.h"
/*!
SMBIOS Structure header as described at
https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.3.0.pdf
(para 6.1.2)
@bqhuyy
bqhuyy / gist:6a4a633f2825836358b2af851a42f9f0
Created September 6, 2022 04:14 — forked from xcodeit/gist:3726868
General principles for good URI design
General principles for good URI design:
Don't use query parameters to alter state
Don't use mixed-case paths if you can help it; lowercase is best
Don't use implementation-specific extensions in your URIs (.php, .py, .pl, etc.)
Don't fall into RPC with your URIs
Do limit your URI space as much as possible
Do keep path segments short
Do prefer either /resource or /resource/; create 301 redirects from the one you don't use
Do use query parameters for sub-selection of a resource; i.e. pagination, search queries
@bqhuyy
bqhuyy / install_nvidia_docker_offline.md
Created August 22, 2022 13:34 — forked from lamhoangtung/install_nvidia_docker_offline.md
How to install nvidia-docker offline for Ubuntu 18.04
@bqhuyy
bqhuyy / android_gdb.md
Created February 22, 2022 09:06 — forked from sekkr1/android_gdb.md
Attaching GDB to Android apps' native libraries

How to GDB android native libraries

[1] Install NDK from android studio

[2] Push appropriate gdb-server to phone

adb push ~/android-sdk-linux/ndk-bundle/prebuilt/android-<arch>/gdbserver/gdbserver /data/local/tmp
adb shell "chmod 777 /data/local/tmp/gdbserver"
adb shell "ls -l /data/local/tmp/gdbserver"

[4] Forward ports

adb forward tcp:1337 tcp:1337

reverse port forwarding

Dùng để map port máy local đến server
ssh [-f: background] [-N: forwarding only] -R <host_port>:localhost:<client_port> <host_domain>

map port

Dùng để map port server về local
ssh [-f] [-N] -L 0.0.0.0:<client_port>:localhost:<host_port> user@<host_domance> -p <port>

using public ip to host server

  1. open port in router (for public ip) => map local port and public port
@bqhuyy
bqhuyy / generate-ssh-key.sh
Created January 9, 2021 16:21 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa
@bqhuyy
bqhuyy / private_fork.md
Created June 21, 2020 13:34 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git