Skip to content

Instantly share code, notes, and snippets.

suffix="_nogps"
for f in "$@"
do
extension=${f##*.}
newfile="${f%.$extension}$suffix.$extension"
/usr/local/bin/exiftool -gps:all= -xmp:geotag= "$f" -o "$newfile"
done
@andyli
andyli / AbstractClass.hx
Last active June 24, 2021 13:40
Java abstract class implemented in Haxe macros. Related: https://groups.google.com/forum/?fromgroups=#!topic/haxelang/WzeI-N1XbIg
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
using Lambda;
/**
Old school abstract class.
Classes that implements it, and their sub-classes, will be able to declare abstract methods (methods that without body).
There will be a check in compile-time such that no public constructor is allowed without all abstract methods implemented.
*/
@andyli
andyli / index.js
Last active August 11, 2020 16:05
telegraf-session-mysql bug causing a bot doesn't response after first reply
const express = require('express');
const Telegraf = require("telegraf");
const MySQLSession = require('telegraf-session-mysql');
const token = process.env.TGBOT_TOKEN;
const telegraf = new Telegraf(token);
const session = new MySQLSession({
host: process.env.MYSQL_ENDPOINT,
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
@andyli
andyli / PerspectiveImage.hx
Created April 9, 2010 13:39
Draw distorted image like perspective transform.
//Ported from the work of Zeh:
//http://zehfernando.com/2010/the-best-drawplane-distortimage-method-ever/
import flash.display.BitmapData;
import flash.display.Graphics;
import flash.geom.Point;
import flash.Vector;
class PerspectiveImage {
/**
package;
/*
* 1€ Filter http://www.lifl.fr/~casiez/1euro/
* Haxe version by Andy Li (andy@onthewings.net)
*
* Based on OneEuroFilter.cc - Nicolas Roussel (nicolas.roussel@inria.fr)
*/
class OneEuroFilter {
@andyli
andyli / keybase.md
Created March 18, 2019 19:16
keybase.md

Keybase proof

I hereby claim:

  • I am andyli on github.
  • I am andyli (https://keybase.io/andyli) on keybase.
  • I have a public key whose fingerprint is DF01 A922 9726 D0FA 42F7 5706 6DAC 3C44 8773 381A

To claim this, I am signing this object:

@andyli
andyli / Test.hx
Created January 16, 2016 12:54
Demo extern of jQuery Impromptu
@:native("$.prompt")
extern class Impromptu {
@:selfCall // @:selfCall avoid generation of `new`
public function new(msg:Dynamic, ?options:Dynamic):Void;
static public function setDefaults(options:Dynamic):Void;
static public function open(states:Dynamic, ?options:Dynamic):Impromptu;
}
class Test {
@andyli
andyli / IEMaxScriptStatements.bat
Created January 30, 2017 08:42
Sauce Labs: How to hide "Stop running this script?" dialogs
@echo off
reg add "HKCU\Software\Microsoft\Internet Explorer\Styles" /f
reg add "HKCU\Software\Microsoft\Internet Explorer\Styles" /v "MaxScriptStatements" /t REG_DWORD /d 0xFFFFFFFF /f
@andyli
andyli / keybase.md
Created July 14, 2016 18:19
keybase.md

Keybase proof

I hereby claim:

  • I am andyli on github.
  • I am andyli (https://keybase.io/andyli) on keybase.
  • I have a public key whose fingerprint is F575 267D E25B 1A5D 8835 75D6 D60F B02A C411 6C69

To claim this, I am signing this object:

@andyli
andyli / main.cpp
Created July 7, 2015 05:37
const char * a is NOT a pointer to immutable char
#include<iostream>
using namespace std;
int main(int argc, char** argv) {
char c = 'a';
const char * a = &c;
// *a = 'b'; // error: read-only variable is not assignable
cout << *a << endl; //a
c = 'b';