Skip to content

Instantly share code, notes, and snippets.

View Leask's full-sized avatar
🏠
Working from home

Sixia "Leask" Huang Leask

🏠
Working from home
View GitHub Profile
@Leask
Leask / sedtris.sed
Created April 21, 2012 11:53
sed tetris by Julia Jomantaite
#!/usr/bin/sed -nf
# sedtris.sed - sed tetris
# 26th of May, 2008
# Julia Jomantaite <[email protected]>
1{
s/.*/ 2a2a2a2a|3a3a3a3a3a3a3a3a3a3a|2a2a2a2a~/
s/[^~]*~$/&&&/
s/.*/& 2a2a2a2a|0a0a0a0a0a0a0a0a0a0a|2a2a2a2a~/
s/[^~]*~$/&&&&&&&&&&&&&&&&&&&&/
s// 2a2a2a2a|4a4a4a4a4a4a4a4a4a4a|2a2a2a2a~/
@Leask
Leask / index.html
Created October 21, 2012 12:35
Time controller
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="time.css" type="text/css"/>
<title>Time controller</title>
</head>
<body onselectstart="return false">
<div class="blackmask"></div>
<section>
@Leask
Leask / lyric
Created November 26, 2012 15:01 — forked from scturtle/gist:3696493
Fetch lyrics from qianqian.com
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Flora Lyric by LeaskH.com
# Originated by scturtle <[email protected]>
import urllib, urllib2
import random
import re
import argparse
from xml.dom import minidom
@Leask
Leask / cliTunes
Last active May 14, 2018 14:15
Control iTunes in Terminal
#!/usr/bin/php
<?php
# Flora iTunes CLI by LeaskH.com
# Based on David Schlosnagle & David West's work
$based = 'tell application "iTunes"';
$list = 'Instance';
$actions = array(
'status' => array(
'',
@Leask
Leask / libcjk.php
Created November 27, 2012 08:03
Some useful functions working with CJK processing
<?php
// Flora LibCjk by LeaskH.com
/**
* Dictionary:
* http://plugins.svn.wordpress.org/sil-dictionary-webonary/trunk/include/dictionary-search.php
* http://stackoverflow.com/questions/5074161/what-is-the-most-efficient-way-to-whitelist-utf-8-characters-in-php
*/
function get_CJK_unicode_ranges() {
return array(
@Leask
Leask / flora_prompt.sh
Last active May 15, 2018 09:11
[DETACHED] Just another prompt with git infos and smile icons
RED="\[\033[31m\]"
GEN="\[\033[32m\]"
YEL="\[\033[33m\]"
OFF="\[\033[m\]"
NME="\u"
HST="\h"
DIR="\w"
DTE="`date`"
# TST="`date +%s`"
# LCT="[`whereami`]"
@Leask
Leask / cruzer
Created November 27, 2012 13:12
Built Linux Ramdisk in order to boot linux from a USB disk on a Mac with VMware Fusion.
#!/bin/bash
# Flora Rebuilt Linux Ramdisk by LeaskH.com
if [ "`/Library/Application\ Support/VMware\ Fusion/vmware-rawdiskCreator print /dev/disk1 | grep -c 'Linux'`" -eq 1 ]; then
LinuxDiskId=1;
fi
if [ "`/Library/Application\ Support/VMware\ Fusion/vmware-rawdiskCreator print /dev/disk2 | grep -c 'Linux'`" -eq 1 ]; then
LinuxDiskId=2;
fi
if [ "`/Library/Application\ Support/VMware\ Fusion/vmware-rawdiskCreator print /dev/disk3 | grep -c 'Linux'`" -eq 1 ]; then
@Leask
Leask / speech
Created December 2, 2012 11:14
A extension of Say command in Mac OS X
#!/usr/bin/php
<?php
# Flora Speech by LeaskH.com
# Import
# Depended on Flora LibCjk ( https://gist.github.com/4153061 )
include_once('/Users/leask/Documents/Working/libcjk/libcjk.php');
# Config
$cjk = array('Samantha', 'Sin-Ji');
@Leask
Leask / flora_search.sh
Created December 4, 2012 15:40
Source this script then search the web!
# Flora Search by LeaskH.com
function encode() {
echo "$*" | LANG=C awk '
function char2hex(char) {
for (j = 0; j < 256; j++) {
if (sprintf("%c", j) == char) {
return sprintf("%%%X", j);
}
}
@Leask
Leask / CSVToArray.js
Created April 1, 2013 07:37
This will parse a delimited string into an array of arrays. The default delimiter is the comma, but this can be overriden in the second argument.
<--- --------------------------------------------------------------------------------------- ----
Blog Entry:
Ask Ben: Parsing CSV Strings With Javascript Exec() Regular Expression Command
Code Snippet:
1
Author:
Ben Nadel / Kinky Solutions