Skip to content

Instantly share code, notes, and snippets.

View yzgyyang's full-sized avatar

Guangyuan Yang yzgyyang

View GitHub Profile
@yzgyyang
yzgyyang / Git_discard_unstaged_changes.md
Last active June 12, 2017 13:55
Git discard unstaged changes

To remove all untracked files:

git clean -df

For a specific file use:

git checkout path/to/file/to/revert
@yzgyyang
yzgyyang / Git_remember_Github_login_credentials.md
Last active June 20, 2017 15:05
Git remember Github login credentials

Set git to use the credential memory cache:

git config --global credential.helper cache

To change the default password cache timeout, enter the following:

git config --global credential.helper 'cache --timeout=3600'
# (setting is in seconds)
@yzgyyang
yzgyyang / Skip_sudo_password.md
Last active June 20, 2017 15:07
Skip sudo password

Edit the sudoers file:

sudo visudo

Find this line:

%sudo ALL=(ALL) ALL
@yzgyyang
yzgyyang / FreeBSD_backup_filesystem.md
Created June 20, 2017 15:15
FreeBSD backup filesystem

To dump a filesystem into /mnt (a filesystem mounted on a seperate disk)…

cd /mnt
dump -L -0 -f- /path/to/origin | restore -r -f-

For remote operations, pipe the restore command via ssh:

dump -L -0 -f- /path/to/origin | ssh -2 -C -l remoteuser 192.168.0.2 restore -r -f-
@yzgyyang
yzgyyang / Git_create_a_new_repo_based_on_existing_ones.md
Created June 28, 2017 21:55
Git create a new repo based on existing ones

cd to local repo containing old_branch and:

git push https://github.com/accountname/new_repo.git +old_branch:master
@yzgyyang
yzgyyang / gist:436d7a05716a48e748ba380783485889
Created October 31, 2017 03:11
Convert VirtualBox .vdi to VMWare .vmdk
VBoxManage list hdds
vboxmanage clonehd 846e5dbd-a88e-439e-8519-ea8aa47d7eb7 D:\Ubuntu.vmdk –format vmdk

Keybase proof

I hereby claim:

  • I am yzgyyang on github.
  • I am yzgyyang (https://keybase.io/yzgyyang) on keybase.
  • I have a public key ASBYJVVTj5GHRdSL8rmS7RNtYEGjvle5hbKWOeX4z2DE9Qo

To claim this, I am signing this object:

@yzgyyang
yzgyyang / get.sh
Last active August 20, 2018 06:50
Coala Bootstrap Script (Experimental)
#!/bin/sh
set -xe
# This script is meant for quick & easy install via:
# $ curl -fsSL URL_HERE | sh
# On FreeBSD:
# $ fetch --no-verify-peer -qo - URL_HERE | sh
get_platform() {
platform=$(uname)
@yzgyyang
yzgyyang / streaming_server.sh
Last active July 16, 2020 21:19
How to start a streaming service on Vultr?
# Restream is another choice
# This guide is based on:
# https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/
sudo apt update
sudo apt upgrade -y
sudo apt install -y unzip build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev
wget http://nginx.org/download/nginx-1.15.1.tar.gz
sudo apt update
sudo apt upgrade -y
# ubuntu: tasksel
sudo apt install kali-desktop-xfce -y
sudo apt install xrdp -y
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
sudo service xrdp start