Skip to content

Instantly share code, notes, and snippets.

💣
Breaking stuff (probably)

Zhaofeng Li zhaofengli

💣
Breaking stuff (probably)
Block or report user

Report or block zhaofengli

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zhaofengli
zhaofengli / gs-criteria.pegjs
Created Jul 8, 2017
SNPedia genoset criteria syntax
View gs-criteria.pegjs
Start
= Comment* fc:FunctionCall Comment* { return fc }
// Function names must be at least 2 characters and must start with a lowercase letter
FunctionName
= first:[a-z] rest:[a-z0-9]i+ { return first + rest.join('') }
FunctionCall
= Ws name:FunctionName '(' Ws args:ArgumentList Ws ')' { return { type: 'FunctionCall', name, args } }
/ Ws name:FunctionName { return { type: 'FunctionCall', name, arguments: [] } }
View keybase.md

Keybase proof

I hereby claim:

  • I am zhaofengli on github.
  • I am zhaofengli (https://keybase.io/zhaofengli) on keybase.
  • I have a public key whose fingerprint is 7F55 777C 745E A208 2DCA 2F5D 5040 FCD6 3E1C 6262

To claim this, I am signing this object:

@zhaofengli
zhaofengli / move.php
Created Mar 29, 2015
Moves MP3 files downloaded via Baidu Music
View move.php
<?php
// Moves MP3 files downloaded via Baidu Music
// By Zhaofeng Li - Public domain
$pattern = "/(?'artist'[^-]+)-(?'album'[^-]+)-(?'title'[^-]+)-/";
$dir = "/sdcard/Baidu_music/download";
$dest = "/sdcard/Music";
$files = scandir( $dir );
foreach ( $files as $file ) {
if ( preg_match( $pattern, $file, $m ) ) {
if ( strpos( $m['artist'], "," ) ) continue;
@zhaofengli
zhaofengli / lrc2srt.php
Created Jan 16, 2015
Quick-and-dirty LRC-to-SubRip converter
View lrc2srt.php
<?php
// Okay, the music player in CM12 only supports srt lyrics files (they must have watched too many films), so...
function lrc2srt( $lrc ) {
$lrc = explode( "\n", $lrc );
$srt = "";
$lines = array();
foreach ( $lrc as $lrcl ) {
if ( preg_match( "|\[(\d\d)\:(\d\d)\.(\d\d)\](.+)|", $lrcl, $m ) ) {
$lines[] = array(
'time' => "00:{$m[1]}:{$m[2]},{$m[3]}0", // convert to SubRip-style time
@zhaofengli
zhaofengli / Reflinks.i18n.php
Created Jan 10, 2015
Reflinks Intuition messages
View Reflinks.i18n.php
You can’t perform that action at this time.