Skip to content

Instantly share code, notes, and snippets.

View Cnly's full-sized avatar
🍩
Absorbing donuts...

Cnly

🍩
Absorbing donuts...
View GitHub Profile
@Cnly
Cnly / my.vpnc
Created December 17, 2020 07:52
#! /bin/bash
INTERNAL_IP4_NETMASK=255.0.0.0
INTERNAL_IP4_NETMASKLEN=8
INTERNAL_IP4_NETADDR=10.0.0.0
shopt -s expand_aliases
alias set_default_route=disabled
alias reset_default_route=disabled
.open-task-list, .jump-top, .top-nav-bar, .divider, #userbar {
display: none !important;
}
.search-block {
position: absolute;
}
#lemmaWgt-secondsKnow,
#side-share,
.navbar-bg-top,
.navbar-bg,
.navbar-wrapper,
.topbar,
.help,
.wgt-footer-main > .content,
.arrow,
.toggle-button,
.doc-upload, .nav-wrap, .docBubble, .wk-other-new-cntent, .doc-tag-wrap, .reader-back2top-wrap, .reader-tools-bar-wrap, .ugctest, .fix-searchbar-wrap {
display: none !important;
}
.header-wrap {
background: #FCFCFC;
}
#! /bin/bash
INTERNAL_IP4_NETMASK=128.0.0.0
INTERNAL_IP4_NETMASKLEN=8
INTERNAL_IP4_NETADDR=10.0.0.0
shopt -s expand_aliases
alias set_default_route=disabled
alias reset_default_route=disabled
@Cnly
Cnly / rpi-mptcp-build.sh
Last active June 9, 2022 17:53
Automatically fetch and [cross] compile MPTCP for Raspberry Pi, yielding an easy-to-use install script.
#! /usr/bin/env bash
RPI_BRANCH=rpi-4.14.y
MPTCP_BRANCH=mptcp_v0.94
# For Pi 1, Pi 0, Pi 0 W, or Compute Module:
#KERNEL=kernel
#DEFCONFIG=bcmrpi_defconfig
# Or, for Pi 2, Pi 3, or Compute Module 3:
KERNEL=kernel7
@Cnly
Cnly / makedeployzip.sh
Last active January 4, 2018 08:34
Make deploy.zip for AWS Lambda
#! /usr/bin/env bash
rm -f deploy.zip
zip -9 -r deploy.zip . --exclude 'venv/*' '.*/*' '.*' '__pycache__/*'
cd venv/lib/python*/site-packages || exit 1
zip -9 -r ../../../../deploy.zip * --exclude 'setuptools-*/*' 'setuptools/*' 'pip-*/*' 'pip/*' 'pkg_resources-*/*' 'pkg_resources/*' 'wheel-*/*' 'wheel/*' '__pycache__/*' '*-info/*' 'easy_install.py'
cd ../../../../
@Cnly
Cnly / xkbwime.sh
Created December 20, 2017 09:56
Remap keys on Gnome (E.g. Swap Alt and Ctrl) without screwing up input methods
#! /usr/bin/env bash
ALL_SOURCES="`gsettings get org.gnome.desktop.input-sources sources`"
SOURCE_COUNT="`echo $ALL_SOURCES | tr -d -c ')' | awk '{ print length; }'`"
CURRENT_SOURCE_STR="`gsettings get org.gnome.desktop.input-sources current`"
CURRENT_SOURCE="${CURRENT_SOURCE_STR#uint32 }"
next_source() {
if [ "$CURRENT_SOURCE" -lt $((SOURCE_COUNT - 1)) ]; then
gsettings set org.gnome.desktop.input-sources current $((CURRENT_SOURCE + 1))
@Cnly
Cnly / ip138.py
Created September 14, 2017 12:56
#! /usr/bin/env python
# Partial original code came from https://www.oschina.net/code/snippet_20912_46623
import urllib2
import re
import sys
import traceback
if len(sys.argv) < 2:
@Cnly
Cnly / jdfcr
Last active July 7, 2016 01:04
JD-decompiled File Cleaning Regex
Search and replace all occurrences with empty string to clean up file(s) decompiled with JD.
\/\* \d+ \*\/ |\/\*\s+?\*\/ |\/\* Location:.+\n.+\n.+\n \*\/