Skip to content

Instantly share code, notes, and snippets.

View mdluo's full-sized avatar

Carl Luo mdluo

View GitHub Profile
@mdluo
mdluo / index.js
Last active September 2, 2021 08:17
Tampermonkey script to sync Spotify now playing tack with gather.town status
// ==UserScript==
// @name Sync Spotify now playing tack with gather.town status
// @namespace https://gather.town
// @version 0.1
// @author mdluo
// @match https://gather.town/app/*
// @icon https://www.google.com/s2/favicons?domain=gather.town
// @grant none
// ==/UserScript==
Sapiens: A Brief History of Human... █████░░░░░░░░ 39%
Atomic Habits: An Easy & Proven W... █████████░░░░ 70%
The Road to Serfdom ███░░░░░░░░░░ 24%
1917: Vladimir Lenin, Woodrow Wil... ▋░░░░░░░░░░░░ 5%
The Power of Your Subconscious Mind █▌░░░░░░░░░░░ 12%
TypeScript 17 hrs 10 mins ████████████░░░░░░░░░ 57.4%
YAML 3 hrs 52 mins ██▋░░░░░░░░░░░░░░░░░░ 12.9%
JavaScript 3 hrs 49 mins ██▋░░░░░░░░░░░░░░░░░░ 12.8%
LESS 1 hr 24 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.7%
JSON 1 hr 10 mins ▊░░░░░░░░░░░░░░░░░░░░ 3.9%
# https://stackoverflow.com/a/13323861
from __future__ import print_function
import numpy as np
from scipy.integrate import simps
from numpy import trapz
# The y values. A numpy array is used here,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@mdluo
mdluo / .gitignore
Created June 5, 2016 18:09
.gitignore for Atom package-sync
/packages/*
!/packages/package-sync
/storage
/compile-cache
/blob-store
/dev
/.npm
/.node-gyp
/.apm
@mdluo
mdluo / selector.js
Created September 14, 2015 08:08
多级联动Select的Ajax实现
(function($){
$(function(){
function loadNext(selector){
$("#catalog_selectors").removeClass('success');
if (selector.val() != 0) {
$.get('goods?m=ajax', {'id':selector.val()}, function(data) {
selector.nextAll().detach();
var nextHtml = "&nbsp;&nbsp;<select name='catalog_select' id='catalog_"+selector.val()+"'' class='input-small'>" +
"<option value='0'>请选择</option>";
var catalogs = data['catalogs'];

Installation

Install the following:

  • Git
  • rbenv
  • Ruby
  • MySQL
  • PostgreSQL
  • SQLite3
@mdluo
mdluo / .gitignore
Last active August 29, 2015 14:10
.gitignore for Android Studio
### Android ###
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
@mdluo
mdluo / l2tp.sh
Last active August 29, 2015 14:10
#!/bin/bash
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this tool!\n"
exit 1
fi
clear
printf "
####################################################
# #