Skip to content

Instantly share code, notes, and snippets.

@lotem
lotem / luna_pinyin.custom.yaml
Created April 6, 2012 15:46
【朙月拼音】模糊音定製模板
# luna_pinyin.custom.yaml
#
# 【朙月拼音】模糊音定製模板
# 佛振配製 :-)
#
# 位置:
# ~/.config/ibus/rime (Linux)
# ~/Library/Rime (Mac OS)
# %APPDATA%\Rime (Windows)
#
@syxc
syxc / 修复系统权限错误.txt
Created May 29, 2012 06:23
sudo chmod 777 / 惨剧修复简单步骤
sudo chmod 777 /
sudo chmod 777 -R /
Linux下以上命令的危害性,试过的人都会觉得可怕,有些人遇到这种情况,第一反应是没救了,其实,你要愿意花功夫去折腾,还是有办法滴!
下面理了下怎么折腾:
道具:
A、B两台电脑,假设都装着Ubuntu 12.04版本的系统,都能ssh、root(平时装Linux的时候这两个最好都弄好了,以备不时之需)。
情景:
现假设「A」是那台悲剧的执行过「sudo chmod 777 /」的电脑,什么效果,就不说了,反正不是什么好事,如果好奇,一试便知!
@ozh
ozh / new empty git branch.md
Last active May 2, 2024 07:39
Create a new empty branch in Git
$ git checkout --orphan NEWBRANCH
$ git rm -rf .

--orphan creates a new branch, but it starts without any commit. After running the above command you are on a new branch "NEWBRANCH", and the first commit you create from this state will start a new history without any ancestry.

You can then start adding files and commit them and they will live in their own branch. If you take a look at the log, you will see that it is isolated from the original log.

@lemiorhan
lemiorhan / post-receive
Last active February 8, 2023 10:06
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@subfuzion
subfuzion / curl.md
Last active May 3, 2024 09:26
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 24, 2024 06:51
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@jjpeleato
jjpeleato / InstallCurlWithHTTP2Support.sh
Last active January 6, 2024 13:39
Install Curl with HTTP2 support. (Script run on Ubuntu 16.04, 18.04 or 20.04)
#! /bin/bash
#
# Shell script for install Curl with HTTP2 support. Script run on Ubuntu 16.04, 18.04 or 20.04
#
# Notes:
# - Ubuntu environment is assumed
# - I did run shell script on Ubuntu 18.04
#
# Gratitude:
@oowl
oowl / gist:133986e8c3d51c1042a0eb0811df0c41
Last active February 4, 2021 13:00
mtr ip location
#!/usr/bin/env python3
import sys
import re
import ipaddress
import requests
baseurl = "https://btapi.ipip.net/host/info"
user_agent = "ipip/tt"
accept_encoding = 'gzip'
ip_re = re.compile(r'''
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active May 2, 2024 11:53
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !