Skip to content

Instantly share code, notes, and snippets.

View adyliu's full-sized avatar
🎯
Focusing

Ady Liu adyliu

🎯
Focusing
  • Beijing, China
View GitHub Profile
@adyliu
adyliu / sqlite3-demo.c
Created September 25, 2012 08:37
An API demo of sqlite3
/*
An API demo of sqlite3
author: Ady Liu
email: [email protected]
web: http://www.blogjava.net/xylz/archive/2012/09/25/388519.html
*/
#include <stdio.h>
#include "sqlite3.h"
int print_record(void *,int,char **,char **);
@adyliu
adyliu / fix-wordpress-rs.py
Created November 13, 2012 06:15
fixed wordpress rss error with blank lines
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
#author: adyliu([email protected])
#version: 0.1
import os
import os.path
import sys
DEBUG='--debug' in sys.argv
@adyliu
adyliu / htmlsubstring.py
Created December 28, 2012 11:48
substring html code without html breaking
adylab:script adyliu$ python3 htmlsubstring.py
<div class="test">测试<span>谁知道&amp;<br>是<br/>什么<br />东东<i>也许吧</i></span><div>我靠,我就不信不行</div><h2>标题党</h2></div>
<div class="test">测试<span>谁知道&amp;<br>是<br/>什么<br />东东<i>也许吧</i></span></div>
<div class="test">测试<span>谁知道&amp;<br>是<br/>什么<br />东东<i>也许吧</i></span></div>
<div class="test">测试<span>谁知道&amp;<br>是<br/>什么<br />东东<i>也许吧</i></span><div>我靠,</div></div>
<div class="test">测试<span>谁知道&amp;<br>是<br/>什么<br />东东<i>也许吧</i></span><div>我靠,</div></div>
<div class="test">测试<span>谁知道&amp;<br>是<br/>什么<br />东东<i>也许吧</i></span><div>我靠,我就不</div></div>
<div class="test">测试<span>谁知道&amp;<br>是<br/>什么<br />东东<i>也许吧</i></span><div>我靠,我就不</div></div>
@adyliu
adyliu / base62.py
Created January 9, 2013 15:55
Base62 encode/decode tools (convert number to string)
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Base62 tools (convert number <=> string)
# v1.0/20130109
# python 2.x/3.x supported
#
#author: Ady Liu([email protected])
#github: github.com/adyliu
import sys
@adyliu
adyliu / build.sh
Created November 27, 2013 08:05
simple http hook for octopress blog hosted on github
#!/bin/bash
echo "build at `date`"
git pull
rake generate
@adyliu
adyliu / Consumers.java
Created June 25, 2014 10:03
Simple Producers for jafka
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.shijiebang.xpower.configcenter.ConfigCenter;
import com.sohu.jafka.consumer.Consumer;
@adyliu
adyliu / ForkJoinDemo.java
Created December 16, 2014 08:43
a fork join demo
/**
*
*/
package demo;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ForkJoinPool;
pragma solidity ^0.4.24;
//==============================================================================
// _ _ _ _|_ _ .
// (/_\/(/_| | | _\ .
//==============================================================================
contract F3Devents {
// fired whenever a player registers a name
event onNewName
@adyliu
adyliu / AddressChecker.java
Created August 3, 2018 07:33
ethereum address checker
package demo;
import java.math.BigInteger;
import java.util.Arrays;
import org.web3j.crypto.Hash;
import org.web3j.utils.Numeric;
public class AddressChecker {
@adyliu
adyliu / CreateAccount.java
Last active August 25, 2019 08:19
create eos account with java
package eos.sample;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;