Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View alanhg's full-sized avatar
⌨️
Focusing

Alan.He alanhg

⌨️
Focusing
View GitHub Profile
@a1o1
a1o1 / SwingFXWebView.java
Created February 21, 2012 15:24 — forked from anjackson/SwingFXWebView.java
Embedding a JavaFX WebView in a Swing panel.
import com.sun.javafx.application.PlatformImpl;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Node;
@JavierParra
JavierParra / radialBattery.sh
Created September 8, 2011 06:38
Displays the battery status of your devices, designed to be used with GeekTool
##################################################################
# YOU NEED IMAGE MAGICK TO RUN THIS #
# DON'T FORGET TO CONFIGURE THE FIRST FEW LINES OF THIS FILE #
##################################################################
# Usage
# 1st - Run this script as a shell geeklet.
#
# You need to pass one of the following parameters:
# ·trackpad
@arnobroekhof
arnobroekhof / pre-commit
Last active May 9, 2022 13:41
Maven pre commit hook
#!/bin/bash
# save the file as <git_directory>/.git/hooks/pre-commit
echo "Running Maven clean test for errors"
# retrieving current working directory
CWD=`pwd`
MAIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# go to main project dir
cd $MAIN_DIR/../../
@condran
condran / FeignClientWithPATCH.md
Last active May 30, 2022 19:18
Spring Cloud Netflix with PATCH (client side)

Spring Cloud Netflix with PATCH (client side)

I have been researching Spring Boot and Spring Cloud, there are lots of goodies here but as with all technology there are gotchas.

Feign Client does not support PATCH out of the box! ಠ_ಠ ... ಠ~ಠ ... ⊙︿⊙

You might see an error like this if you try to use RequestMethod.PATCH in your @FeignClient interface: java.net.ProtocolException: Invalid HTTP method: PATCH

I am using the current versions:

@alanhg
alanhg / install-package-lrzsz.sh
Last active July 16, 2022 08:41
install-package-lrzsz.sh / shell
#!/bin/sh
# sudo sh -c "$(curl -fsSL https://gist.githubusercontent.com/alanhg/6a299b815f4dd3d242abc16b8be6b861/raw/dbe1497208f1d968ed8b67cad09c596e35c5be9c/install-package-lrzsz.sh)"
YUM_CMD=$(which yum)
APT_GET_CMD=$(which apt-get)
APT_CMD=$(which apt)
PACKAGE=lrzsz
if [ ! -z $YUM_CMD ]; then
yum install -y $PACKAGE
@parisk
parisk / default.js
Last active July 18, 2022 14:24
xterm.js keyMap
/**
* Example keymap for usage in xterm.js
* Original issue: https://github.com/sourcelair/xterm.js/issues/487
*/
// We export this as default, since the only thing we care about
// is the contents of the keymap. No classes, methods or anything
// else is expected.
export default let keyMap =
@clarkb7
clarkb7 / unicode.md
Last active August 29, 2022 19:43
A guide to character encoding aware development
@p120ph37
p120ph37 / dualfactor_anyconnect.md
Last active September 29, 2022 03:39
How to connect to a Cisco AnyConnect VPN server from the OSX (or Linux) command-line without using the AnyConnect client. Specifically, one which uses VeriSign/Symantec VIP Access dual-factor tokens.

(For Linux users, make sure you have oathtool and openconnect, then start from Step 6. If you don't have a token secret key, have a friend generate one for you on OSX via steps 3-5)

Step 1

Get homebrew and install oath-toolkit, openconnect, and tuntap.
And follow the additional tuntap installation instructions!

Step 2

After the tuntap module is installed, reboot or use kextload to activate it.

@rambolee
rambolee / update-dnsmasq-from-gfwlist.py
Last active September 22, 2023 09:48
升级 小米路由器3 可以ssh 可以 Shadowsocks [Tags]: 小米路由, 小米路由3, 小米路由器, 小米路由器3, ssh, shadowsocks
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq rules with ipset for gfwlist
#
# Copyright (C) 2014 http://www.shuyz.com
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
import urllib2
import re
@jehiah
jehiah / simple_args_parsing.sh
Created March 4, 2011 16:56
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"