Skip to content

Instantly share code, notes, and snippets.

Ye Feng fengye

  • 8i
  • Wellington
Block or report user

Report or block fengye

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fengye
fengye / check_wifi.sh
Created Sep 29, 2019
Raspberry Pi constantly drop wifi and won't be able to reconnect itself. Run this script on a cron job on a regular basis to keep headless pi connected.
View check_wifi.sh
#!/bin/bash
#=================================================================
# Script Variables Settings
wlan='wlx801f02b56d73'
gateway='192.168.0.1'
alias ifup='/sbin/ifup'
alias ifdown='/sbin/ifdown'
alias ifconfig='/sbin/ifconfig'
#=================================================================
date
@fengye
fengye / build_latest_spigot.sh
Created Aug 9, 2019
Find and build latest spigot minecraft server, suitable for daily or periodic build
View build_latest_spigot.sh
#!/bin/bash
latest=$(python find_latest_spigot.py)
stored_latest=$(<latest.txt)
echo Last stored Spigot version $stored_latest
if [ $stored_latest == $latest ]; then
echo Latest version $latest remains unchanged, not building.
else
echo Building Spigot version $latest
echo $latest > latest.txt
java -Xmx1024M -jar BuildTools.jar --output-dir ./daily_build/ --rev $latest
@fengye
fengye / unimap_cpp_v3.c
Last active Aug 10, 2019
HHKB keymapping for C++ programmers V3
View unimap_cpp_v3.c
#include "unimap_trans.h"
#include "print.h"
enum macro_id {
CPP_POINTER,
CPP_COMMENT,
L3_QUOTE,
L3_MINUS,
L3_LBRACKET,
L3_RBRACKET,
@fengye
fengye / unimap_cpp_v2.c
Last active Jul 27, 2019
HHKB for C++ programmers v2
View unimap_cpp_v2.c
#include "unimap_trans.h"
#include "print.h"
enum macro_id {
CPP_POINTER,
CPP_COMMENT,
L3_QUOTE,
L3_MINUS,
L3_LBRACKET,
L3_RBRACKET,
@fengye
fengye / unimap_cpp_v1.c
Last active Jul 20, 2019
An remapped HHKB layout for C++ programmers.
View unimap_cpp_v1.c
#include "unimap_trans.h"
enum macro_id {
CPP_POINTER,
CPP_COMMENT,
};
// L0, for remapped X keycodes
// 1st row
#define AC_L0_LPRN ACTION_MODS_KEY(MOD_LSFT, KC_9)
@fengye
fengye / unimap_human_v1.c
Last active Jul 18, 2019
HHKB for Human C source in TMK Keyboard firmware
View unimap_human_v1.c
#include "unimap_trans.h"
#define AC_FN1 ACTION_LAYER_MOMENTARY(1)
#define AC_FN2 ACTION_LAYER_TAP_KEY(2, KC_LCTL)
#define AC_ENT2 ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT)
#define AC_LSOS ACTION_MODS_ONESHOT(MOD_LSFT)
#define AC_RSOS ACTION_MODS_ONESHOT(MOD_RSFT)
#define AC_L2(KEY) ACTION_MODS_KEY(MOD_LCTL, KC_##KEY)
@fengye
fengye / nuke_folder.bat
Last active Jul 7, 2019
Take ownership and assign permission then remove all the files recursively in one folder
View nuke_folder.bat
@echo off
setlocal
:PROMPT
@echo DELETING %1 !!!
SET /P AREYOUSURE=Are you sure (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END
takeown /f %1 /r /d y
icacls %1 /grant Everyone:(OI)(CI)F /T
icacls %1 /grant %username%:F /T
@fengye
fengye / HHKB_for_Human_Being.json
Created Jul 6, 2019
Karabiner Complex Modification: HHKB_for_Human_Being
View HHKB_for_Human_Being.json
{
"title": "HHKB for Human Being",
"rules": [
{
"description": "Change left_control+ijkl to arrow keys",
"manipulators": [
{
"from": {
"key_code": "j",
"modifiers": {
View gitPullAllBranches.sh
#!/bin/bash
pushd $1
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
git fetch --all
git pull --all
popd
@fengye
fengye / CursorMode-karabiner.json
Created Nov 26, 2018
CursorMode-karabiner.json
View CursorMode-karabiner.json
{
"description": "Double click ESC to toggle cursor mode. ",
"manipulators": [
{
"conditions": [
{
"name": "cursor_mode_trigger_key_pressed",
"type": "variable_if",
"value": 1
},
You can’t perform that action at this time.