Skip to content

Instantly share code, notes, and snippets.

@hanxue
hanxue / makefile.linux.sh
Created December 2, 2012 11:05
Backup Makefile.linux
$ cd mylammps/src/MAKE
$ cp Makefile.linux Makefile.linux.backup
$ vi Makefile.linux
@hanxue
hanxue / stop autoplay.js
Created December 8, 2012 09:59
Stop autoplay on Youtube
try {
var playerelement=document.getElementById("movie_player");
playerelement.mute();
// Possible values are unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5)
if (playerelement.getPlayerState() == 1) {
if (last_time < 0.01) { // we'll let the player play atleast 0.01 seconds before agreeing that we have a valid time value
last_time = playerelement.getCurrentTime(); // getPlayerState() returns a value, therefore getCurrentTime() should too
}
if ((playerelement.getCurrentTime() - last_time) < 0) { // oops, timetravel!
last_time = playerelement.getCurrentTime();
@hanxue
hanxue / Alternate_row_Google_Spreadsheets.js
Created December 9, 2012 08:55
Highlighting alternate rows in Google Spreadsheets
function colorRowsAlternateSelection() {
var currentSheet = SpreadsheetApp.getActiveSheet();
var currRange = currentSheet.getActiveSelection();
topRow = currRange.getRow();
buttomRow = currRange.getLastRow();
leftCol = currRange.getColumn();
rightCol = currRange.getLastColumn();
colorRows(topRow , buttomRow , leftCol , rightCol );
}
@hanxue
hanxue / autoscan.sh
Created December 16, 2012 10:46
autoscan errors
configure.ac: warning: missing AC_CHECK_FUNCS([memset]) wanted by: src/azurefs.cpp:1503
configure.ac: warning: missing AC_CHECK_FUNCS([mkdir]) wanted by: src/azurefs.cpp:405
configure.ac: warning: missing AC_CHECK_FUNCS([select]) wanted by: src/azurefs.cpp:2827
configure.ac: warning: missing AC_CHECK_FUNCS([strcasecmp]) wanted by: src/azurefs.cpp:105
configure.ac: warning: missing AC_CHECK_FUNCS([strchr]) wanted by: src/azurefs.cpp:4211
configure.ac: warning: missing AC_CHECK_FUNCS([strerror]) wanted by: src/azurefs.cpp:4177
configure.ac: warning: missing AC_CHECK_FUNCS([strncasecmp]) wanted by: src/string_util.cpp:105
configure.ac: warning: missing AC_CHECK_FUNCS([strstr]) wanted by: src/azurefs.cpp:1376
configure.ac: warning: missing AC_CHECK_FUNCS([strtol]) wanted by: src/azurefs.cpp:4274
configure.ac: warning: missing AC_CHECK_FUNCS([strtoul]) wanted by: src/azurefs.cpp:532
@hanxue
hanxue / google_trends_query.js
Created December 19, 2012 13:29
Google Apps Script for querying Google trends
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..f818674
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,3 @@
+include *
+recursive-include * *
+prune .git
\ No newline at end of file
@hanxue
hanxue / dbus-python.patch
Last active December 25, 2015 22:18
Patch to create setup.py for dbus-python Based on this bug https://bugs.freedesktop.org/show_bug.cgi?id=55439 Original patch file at https://bugs.freedesktop.org/attachment.cgi?id=80061
diff --git a/Library/Formula/setup.py b/Library/Formula/setup.py
new file mode 100644
index 0000000..1dc8891
--- /dev/null
+++ b/Library/Formula/setup.py
@@ -0,0 +1,79 @@
+# This file was created SPECIFICALLY to create a bdist that can be generated on an x64 Ubuntu and an x64 Centos
+# machines.
+#
+# Centos notes:
require 'formula'
class DBusPython < Formula
url 'http://dbus.freedesktop.org/releases/dbus-python/dbus-python-1.2.0.tar.gz'
sha1 '7a00f7861d26683ab7e3f4418860bd426deed9b5'
def install
# Install dbus-python package dependency first
# system "./configure", "--prefix=#{prefix}"
# system "make", "install"
--- squid.conf 2013-10-21 20:46:05.000000000 +0800
+++ patch/squid-patched.conf 2013-10-21 23:49:07.000000000 +0800
@@ -2469,10 +2469,18 @@
# URL - ie, what it fetches. The Store URL rewriter rewrites Squid's
# _store_ URL - ie, what it uses to store and retrieve objects.
#
#Default:
# none
+#### BEGIN Add to squid.conf for intelligentmirror ####
+storeurl_rewrite_program /usr/bin/python /etc/squid/intelligentmirror/intelligentmirror.py
0707070000000000000407550527620011600000040000001222457334100000200000000000.0707070000000000011007550000000000000000010000001222457334100001600000007351./postinstall#!/bin/bash
#by doing the below, we are ensuring we are modifying the target system the package is being installed on,
#not the OS running the installer
declare -x dest_vol="${3}"
declare -x dscl="${dest_vol}/usr/bin/dscl"
declare -x dspath="${dest_vol}/var/db/dslocal/nodes/Default/"
declare -x scripts_dir="${1}/Contents/Resources/"
declare -x awk="/usr/bin/awk"
declare -x last_user_id='-1'