Skip to content

Instantly share code, notes, and snippets.

View zjuchenyuan's full-sized avatar

ChenYuan zjuchenyuan

View GitHub Profile
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
@mgeeky
mgeeky / vm-auto-snapshot.sh
Last active July 24, 2022 20:15
Script to manage auto-snapshots for specified VirtualBox VM. Able to rotate snapshots, create, restore and delete ones.
#!/bin/bash
# vim: ts=4 sw=4 et
#
# Auto-snapshotting script intended to be cron'ed,
# taking automatic snapshots of particular VM, logging that actions,
# and providing means of restoring specific snapshots.
# Included with functionality of rotating them (like logrotate).
#
# Example cron entry for this script:
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active May 2, 2024 01:27
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@chichunchen
chichunchen / wget 中文亂碼
Created January 26, 2015 18:40
用 wget 从服务器下载文件经常遇到中文文件名变成乱码的问题。
reference: http://m13253.blogspot.tw/2013/04/solve-corrupted-chinese-filename-for-wget.html
其实不必要像那样修改源代码,wget 的 man 页面里就有解决方法。
正解是参数 --restrict-file-names=nocontrol
Update: +筱百合 提供了他的 ~/.wgetrc 文件,方便大家借鉴:
# 不要乱转义中文
--restrict-file-names=nocontrol
# 使用重定向后的文件名
--trust-server-names=on
@quark-zju
quark-zju / gdb-trace.py
Last active December 31, 2023 14:14
Trace all function calls using gdb
#!/usr/bin/env python
try:
import gdb
inside_gdb = True
except ImportError:
inside_gdb = False
if inside_gdb:
@gubatron
gubatron / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md
Last active March 12, 2024 07:34
How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

Let's say alice is a github.com user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

https://github.com/alice/repo1

https://github.com/alice/repo2

You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers.

@allex
allex / gist:11203573
Last active December 5, 2023 07:27
Ubuntu 安装中文字体

环境 (Environment)

版本:Ubuntu 14.04 LTS 默认语言:English(United States)

安装 (Setup)

Debian 和 Ubuntu 下对中文支持比较好的字体有: fonts-droid、ttf-wqy-zenhei 和 ttf-wqy-microhei 等,除了文泉驿系列字体外,比较流行的免费中文字体还有文鼎提供的楷体和上海宋,包名分别是: fonts-arphic-ukai 和 fonts-arphic-uming。

@joeyespo
joeyespo / app.py
Last active May 5, 2017 04:56
Example XSS with the new `|tojson` behavior in Flask 0.10
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
# Expected value
ids = [u"one", u"two's", u'"three"']
@sergiotapia
sergiotapia / md5-example.go
Last active December 5, 2023 03:53
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@gerbenvandijk
gerbenvandijk / OldBrowser.js
Created November 19, 2013 09:56
Detect if the user has an old browser and if so, it inserts a friendly notification that not all features on the site will work, and that an upgrade is recommended.
// The code - first bit is all the UserAgent library.
(function(wndw) {
var Browsers, OS, Platform, Versions, browser_name, browser_version, os, platform;
Versions = {
Firefox: /firefox\/([\d\w\.\-]+)/i,
IE: /msie\s([\d\.]+[\d])/i,
Chrome: /chrome\/([\d\w\.\-]+)/i,
Safari: /version\/([\d\w\.\-]+)/i,
Ps3: /([\d\w\.\-]+)\)\s*$/i,
Psp: /([\d\w\.\-]+)\)?\s*$/i