Skip to content

Instantly share code, notes, and snippets.

View weiyiao's full-sized avatar

Willy Wang weiyiao

View GitHub Profile
@weiyiao
weiyiao / set_proxy.sh
Last active November 21, 2024 10:06
Ubuntu Script for setting and removing proxy settings
#!/bin/bash
# Enable strict mode
set -euo pipefail
IFS=$'\n\t'
#===============================================================================
# Constants and Global Configuration
#===============================================================================
readonly DEFAULT_PROXY_SERVER="proxy.example.com"
@weiyiao
weiyiao / git_remember_password.md
Created May 17, 2024 03:46 — forked from ankurk91/git_remember_password.md
Git credential cache, why type password again and again

Tired of entering password again and again ?

Run this command to remember your password:

git config --global credential.helper 'cache --timeout 28800'

Above command will tell git to cache your password for 8 hours.

@weiyiao
weiyiao / geocoder-service.js
Created May 11, 2016 01:35 — forked from benmj/geocoder-service.js
An AngularJS Service for intelligently geocoding addresses using Google's API. Makes use of localStorage (via the ngStorage package) to avoid unnecessary trips to the server. Queries Google's API synchronously to avoid `google.maps.GeocoderStatus.OVER_QUERY_LIMIT`
/*global angular: true, google: true, _ : true */
'use strict';
angular.module('geocoder', ['ngStorage']).factory('Geocoder', function ($localStorage, $q, $timeout) {
var locations = $localStorage.locations ? JSON.parse($localStorage.locations) : {};
var queue = [];
// Amount of time (in milliseconds) to pause between each trip to the