Skip to content

Instantly share code, notes, and snippets.

View yzgyyang's full-sized avatar

Guangyuan Yang yzgyyang

View GitHub Profile
@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 / 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 / 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 / FreeBSD_mount_img_files.md
Created June 28, 2017 20:46
FreeBSD mount img files

Determine the file system by using the file-utility.

file image.img

Use mdconfig to link the IMG image to a virtual device.

mdconfig -a -t vnode -f /path/to/image.img -u 0
@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 / build_chromium_os.sh
Last active December 1, 2022 09:20
Build Chromium OS from Ubuntu curl -fsSL URL_HERE | sh
#!/bin/sh
set -xe
sudo apt-get install git-core gitk git-gui subversion curl lvm2 thin-provisioning-tools python-pkg-resources python-virtualenv python-oauth2client
# install depot tools
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
PATH=$PATH:/path/to/depot_tools
# Making sudo a little more permissive