Skip to content

Instantly share code, notes, and snippets.

View passos's full-sized avatar

Jinyu Liu passos

View GitHub Profile
@passos
passos / DBUtils.pm
Created October 28, 2014 10:17
DBUtils for Perl
package DBUtils;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = @EXPORT_OK = qw(
prepare_stat
exec_sql
exec_stat
query_data
@passos
passos / filter.txt
Last active September 13, 2020 18:43
|http://pc.zmzapi.com/pc_html/pages
|http://pc.zmzapi.com/*a=ad_list|
@passos
passos / a.com
Created May 26, 2012 15:00
deassemble code "B311 F6E3 B30A F6F3 8AC4"
D:\>DEBUG A.COM
-U
13FB:0100 B100 MOV CL,00
13FB:0102 88C8 MOV AL,CL
13FB:0104 B311 MOV BL,11
13FB:0106 F6E3 MUL BL
13FB:0108 B30A MOV BL,0A
13FB:010A F6F3 DIV BL
13FB:010C 8AC4 MOV AL,AH
13FB:010E 88C2 MOV DL,AL
@passos
passos / remove_multiple_space.c
Created March 29, 2012 05:26
Remove multiple spaces, answers gist.github.com/2227226
#include <stdio.h>
int removeMultipleSpace(char baseStr[])
{
char *p = baseStr;
char *t = baseStr;
while ( *p ) {
if ( *p == ' ' ) {
*t++ = *p++;
@passos
passos / remove_multiple_space.c
Created March 29, 2012 05:25
Remove continuous spaces, answers gist.github.com/2227226
#include <stdio.h>
int removeMultipleSpace(char baseStr[])
{
char *p = baseStr;
char *t = baseStr;
while ( *p ) {
if ( *p == ' ' ) {
*t++ = *p++;
@passos
passos / make-android-src-tree.sh
Created September 5, 2011 11:59
A script to scan Android code repo and generate source code for sdk
#!/bin/bash
dest_dir=~/workspace/src-tree
if [ ! -z "$1" ]; then
dest_dir=$1
fi
curr_dir=$PWD
dirname=$(basename $dest_dir)
@passos
passos / gist:1071933
Created July 8, 2011 14:15
Chinese Chess problem solution 2
BYTE i = 81;
while (i--)
{
if (i / 9 % 3 != i % 9 % 3)
printf("A = %d, B = %dn", i / 9 + 1, i % 9 + 1);
}
@passos
passos / gist:1071928
Created July 8, 2011 14:14
Chinese Chess problem solution 1
#include <stdio.h>
void main()
{
short unsigned int x;
for (x = 0; (x & 0xF0) < 0x90; x += 0x10 ) {
for ( x &= 0xF0; (x & 0x0F) < 9; x++)
if ((x >> 4) % 3 != (x & 0x0F) % 3)
printf("A = %d, B = %d\n", (x >> 4) + 1, (x & 0x0F) + 1);
@passos
passos / Dumper.py
Last active March 24, 2023 02:55
A perl Data.Dumper clone for Python
"""
A perl Data.Dumper clone for Python
Author: simon@log4think.com
2011-07-08
Copyright 2011 Jinyu LIU
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.