Skip to content

Instantly share code, notes, and snippets.

View andjc's full-sized avatar

Andj andjc

  • Melbourne, Australia
View GitHub Profile
@lawlesst
lawlesst / search_z3950.py
Created July 23, 2011 13:09
Sample Z39.50 search with Python.
"""
Simple script to search a Z39.50 target using Python
and PyZ3950.
"""
from PyZ3950 import zoom
ISBNs = ['9781905017799', '9780596513986']
@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@manuelmorales
manuelmorales / ghostxps.sh
Created April 17, 2012 11:01
Installing GhostPDL (with GhostXPS) on Ubuntu Oneiric
sudo apt-get install libxext-dev libxt-dev
wget http://downloads.ghostscript.com/public/ghostpdl-9.05.tar.bz2
tar xjf ./ghostpdl-9.05.tar.gz
cd ghostpdl-9.05/
./configure
echo '#define HAVE_SYS_TIME_H' >> xps/obj/gconfig_.h
make xps
./xps/obj/gxps -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -r150 -o /tmp/a.pdf ~/POWERPOINT.xps
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@slevithan
slevithan / xregexp-unicode-codepoints.js
Created May 7, 2012 20:54
Full 21-bit Unicode code point matching in XRegExp with \u{10FFFF}
// Allow syntax extensions
XRegExp.install("extensibility");
/* Adds Unicode code point syntax to XRegExp: \u{n..}
* `n..` is any 1-6 digit hexadecimal number from 0-10FFFF. Comes from ES6 proposals. Code points
* above U+FFFF are converted to surrogate pairs, so e.g. `\u{20B20}` is simply an alternate syntax
* for `\uD842\uDF20`. This can lead to broken behavior if you follow a `\u{n..}` token that
* references a code point above U+FFFF with a quantifier, or if you use the same in a character
* class. Using `\u{n..}` with code points above U+FFFF is therefore not recommended, unless you
* know exactly what you're doing. XRegExp's handling follows ES6 proposals for `\u{n..}`, since
@eimg
eimg / mmstrlen.php
Created May 31, 2012 12:03
Count no. of syllabes in a Myanmar Unicode string.
<?php
function mmstrlen($str) {
$standalones = array("ဤ", "၍", "ဪ", "၏", "၊", "။", "၌");
$consonants = array("က", "ခ", "ဂ", "ဃ", "င", "စ", "ဆ", "ဇ", "ဈ", "ည", "ဍ", "ဌ", "ဋ", "ဎ", "ဏ", "တ", "ထ", "ဒ", "ဓ", "န", "ပ", "ဖ", "ဗ", "ဘ", "မ", "ယ", "ရ", "လ", "ဝ", "သ", "ဟ", "ဠ", "အ");
$numbers = array("၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉");
$len = mb_strlen($str, "UTF-8");
$count = 0;
for($i = 0; $i < $len; $i++) {
@saturngod
saturngod / myanmartext.js
Created February 13, 2013 16:10
check myanmar text or not
var regexMM = new RegExp("[\u1000-\u109f\uaa60-\uaa7f]+");
var text = "မြန်မာ";
if (!regexMM.test(text)) {
console.log("not myanmar text");
}
else {
console.log("myanmar text");
}
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@greenlikeorange
greenlikeorange / fonttaggle.js
Last active August 29, 2015 14:09
ကိန္ဒရီ ဖောင့်တွဲခွဲ စနစ်
/**
* Knayi-myscript Detection and font tagging script
*
* Nov 10, 2014
* greenlikeorange<beginofalove@hotmail.com>
*
* original:
* https://github.com/greenlikeorange/knayi-myscript
*
*/
@HughP
HughP / UAX_29.py
Created March 30, 2015 06:10
PyICU
# We start by loading up PyICU.
import PyICU as icu
# Let's create a test text. Notice it contains some punctuation.
test = u"This is (\"a\") test!"
# We create a wordbreak iterator. All break iterators in ICU are really RuleBasedBreakIterators, and we need to tell it which locale to take the word break rules from. Most locales have the same rules for UAX#29 so we will use English.
wb = icu.BreakIterator.createWordInstance(icu.Locale.getEnglish())
# An iterator is just that. It contains state and then we iterate over it. The state in this case is the text we want to break. So we set that.