Skip to content

Instantly share code, notes, and snippets.

Avatar
🐒
productivity--

Marco Leong marcoleong

🐒
productivity--
View GitHub Profile
@marcoleong
marcoleong / handler.py
Created Jan 29, 2019
Kubeless Python Botte response binary file
View handler.py
from bottle import abort, HTTPResponse
def handle(data, event):
headers = dict()
content = # binary content
headers['Content-Type'] = 'image/jpeg'
headers['Content-Disposition'] = 'inline'
headers['Content-Length'] = len(content)
View login.js
function receiveLoginUser (user) {
return {type: 'RECEIVE_LOGIN_USER', payload: user}
}
function login (email, password) {
return (dispatch) => {
// 可以呢到再dispatch(loadingLogin(true))
return axios.post("xxxx/login", { email, password }).then(response => {
dispatch(receiveLoginUser(response.user))
View gist:d504b4fb916a5e7f00124547394815f0
Verifying my Blockstack ID is secured with the address 1BWJAGmwniQLu9DpM9X6DM9eEFWpuYRa9e https://explorer.blockstack.org/address/1BWJAGmwniQLu9DpM9X6DM9eEFWpuYRa9e
View keybase.md

Keybase proof

I hereby claim:

  • I am marcoleong on github.
  • I am marcoleong (https://keybase.io/marcoleong) on keybase.
  • I have a public key whose fingerprint is D091 CF99 4114 1E51 92C0 6C02 6222 AFC3 65CB C217

To claim this, I am signing this object:

@marcoleong
marcoleong / update-namecheap-ddns
Created Jul 4, 2015
Mitrotik Router Dynamic DNS update script for Namecheap DDNS
View update-namecheap-ddns
:log info "NamecheapDDNS: start updating..."
:global ddnspass "yourownddnspass"
:global theinterface "pppoe-out1"
:global ddnshost "subdomain"
:global ddnsdomain "example.com"
:global ipddns [:resolve "$ddnshost.$ddnsdomain"];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
View test-import
====== outputScheduler-1 ====== Max rows to process: 284, highest column: AMK
Processing LAT209...
Processing LBA236_GS...
Processing LBA236_SW...
Processing LCO101_GS...
Processing LCO103_GS...
Processing LCO105_SW...
section LCO105_SW/5222 - CANNOT find teacher TBC01
Processing LCO107_SW...
Processing LGS203...
View OAuth2Config.java
package ums.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
View new_gist_file
/** Sample for use of templates
* This sample uses the file TextTemplateWithUserFields.odt from the Samples
* folder. The file contains a number of User text fields (Variables - User)
* and a bookmark which we use to fill in various values
*/
protected void templateExample() throws java.lang.Exception {
// create a small hashtable that simulates a rowset
Hashtable recipient = new Hashtable();
recipient.put("Company", "Manatee Books");
recipient.put("Contact", "Rod Martin");
@marcoleong
marcoleong / init_provision.sh
Created Jul 19, 2013
Puppet first provision shell use it by ``` bash -c "$(curl -fsSL https://gist.github.com/marcoleong/6037221/raw)" ```
View init_provision.sh
#!/usr/bin/env bash
#
# This bootstraps Puppet on Ubuntu 12.04 LTS.
#
set -e
# Load up the release information
. /etc/lsb-release
REPO_DEB_URL="http://apt.puppetlabs.com/puppetlabs-release-${DISTRIB_CODENAME}.deb"
View ubuntu-precise-install-puppet-agent.sh
#/bin/bash
# run bash <(curl -sS https://gist.github.com/marcoleong/5573628/raw)
# author: Marco Leong (marcoleong at Github)
cd /tmp
echo "Downlaoding http://apt.puppetlabs.com/puppetlabs-release-precise.deb..."
wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb
echo "Installing puppetlabs-release-precise.deb"