Skip to content

Instantly share code, notes, and snippets.

View livibetter's full-sized avatar

Yu-Jie Lin livibetter

View GitHub Profile
@livibetter
livibetter / winxp-setup.sh
Last active August 29, 2015 13:57
Fake winxp setup for 2014 April Fools' Day
#!/bin/bash
# This script was written by Yu-Jie Lin in Public Domain, for 2014 April Fools'
# Day for making a YouTube video, 100% not real.
#
# Even one day, Microsoft does release Windows XP source code, which I believe
# it would, but not in near future, I don't think it's possible to release
# under the GPL.
#
# YouTube: https://www.youtube.com/watch?v=-awZX1CWgxU
@livibetter
livibetter / benchmark.py
Last active August 29, 2015 14:27
Simple performance test on Universal Feed Parser (feedparser) and speedparser
#!/usr/bin/env python
# Written by Yu-Jie Lin
# Placed in Public Domain
# Blog: http://blog.yjl.im/2015/08/speedparser-vs-feedparser-in-performance.html
from timeit import timeit
import feedparser as fp
import speedparser as sp
@livibetter
livibetter / 666.sh
Created March 9, 2011 02:37
6 op1 6 op2 6 = ?
#!/bin/bash
OPs="{++,--,**,*,/,%,+,-,\<\<,\>\>,\&,^,\|}"
eval "echo -ne ${OPs}' '${OPs}'\n'" |
while read op1 op2; do
for eq in "6 $op1 6 $op2 6" "(6 $op1 6) $op2 6" "6 $op1 (6 $op2 6)"; do
read a b c d e <<<"$eq"
if [[ "$eq" == *\) ]] && [[ "$op1" == [/%] ]] && ((6 $op2 6 == 0)); then
printf -v ans "%19s∞" ""
else
ans=$((eq))
@livibetter
livibetter / inkscape-poppler.diff
Created August 15, 2011 09:20
unsubmitted (prob not finished, either) patch for Inkscape about poppler library
=== modified file 'configure.ac'
--- configure.ac 2011-08-05 16:47:02 +0000
+++ configure.ac 2011-08-10 12:47:21 +0000
@@ -521,101 +521,96 @@
dnl Libpoppler checking
dnl ******************************
+AC_ARG_ENABLE(poppler,
+ AC_HELP_STRING([--enable-poppler], [enable libpoppler for loading PDF file]),
+ [enable_poppler=$enableval], [enable_poppler=yes])
#!/usr/bin/env python
import re
good = 'abc'
bad = 'ab\x00c'
#$rgx = '/^[\x00-\x20\x22\x2F\x3A\x3C\x3E\x5C]{1,'.strlen($tistr).'};/';
From 77e63fcbcd035d4ac321a1914100170172e734bb Mon Sep 17 00:00:00 2001
From: Yu-Jie Lin <livibetter@gmail.com>
Date: Thu, 8 Sep 2011 18:21:59 +0800
Subject: [PATCH] Add new pos option below_curosr (bcur)
---
README.markdown | 3 ++-
twmnd/twmnd.pro | 2 +-
twmnd/widget.cpp | 25 ++++++++++++++++++++++++-
twmnd/widget.h | 1 +
Index: bin/repoman
===================================================================
--- bin/repoman (revision 15844)
+++ bin/repoman (working copy)
@@ -17,10 +17,12 @@
from commands import getstatusoutput as subprocess_getstatusoutput
import errno
import formatter
+import httplib
import logging
@livibetter
livibetter / jtv-onair.css
Created January 29, 2012 18:03
ON AIR light for Justin.tv
@import url(ttp://fonts.googleapis.com/css?family=Ruda:900);
.JTVOnAir {
background-color: #000;
color: #800;
border: 0.125ex solid #222;
font-family: Ruda, sans-serif;
font-weight: 900;
line-height: 1em;
height: 1em;
@livibetter
livibetter / ga-wr.js
Created January 31, 2012 21:36
Using Google Analytics for Website Issue Reporting
/* Copyright 2012 Yu-Jie Lin
* MIT License */
function GAWR(options) {
var self = this;
// -----
this.report = function(entry) {
// Google Analytics
function _report() {
var _gaq = window._gaq || [];
@livibetter
livibetter / ot.py
Created February 3, 2012 22:16
Python object traversing
#!/usr/bin/env python3
# Copyright (c) 2012 Yu-Jie Lin
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#