Skip to content

Instantly share code, notes, and snippets.

@wuyongzheng
wuyongzheng / cnadv6055e1.ppd
Created May 31, 2012 08:27
PPD for Canon iR-ADV 6055/6065
*PPD-Adobe: "4.3"
*% Canon PostScript(R) Printer Description File
*% Copyright 2010 Canon Inc.
*% All Rights Reserved.
*% Permission is granted for redistribution of this file as
*% long as this copyright notice is intact and the contents
*% of the file is not altered in any way from its original form.
*% End of Copyright statement for Canon iR-ADV 6055/6065.
*% Copyright 2010 Canon Inc. All rights reserved.
*%
@wuyongzheng
wuyongzheng / gist:1221685
Created September 16, 2011 09:40
base64 encoder in Java
private static final char [] base64Map =
("ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
"abcdefghijklmnopqrstuvwxyz" +
"0123456789+/").toCharArray();
private static String base64Encode (byte [] bytes)
{
if (bytes.length % 3 != 0)
bytes = Arrays.copyOf(bytes, bytes.length + 3 - bytes.length % 3);
char [] str = new char [bytes.length*4/3];
for (int i = 0; i < str.length / 4; i ++) {
@wuyongzheng
wuyongzheng / tcpsr.c
Created August 25, 2011 15:26
tcpsr: tcp send & receive utility
/* tcpsr: tcp send & receive utility
* 1. connect to server
* 2. send the data which is read from stdin
* 3. receive until close or timeout
*
* return status: (read code)
* public repo: https://gist.github.com/1170922 */
#include <stdio.h>
#include <unistd.h>
@wuyongzheng
wuyongzheng / dexiami
Created June 15, 2011 09:03
Decode xiami xml's location url
public static String dexiami (String code)
{
int i2 = Integer.parseInt(code.substring(0, 1));
code = code.substring(1);
int i4 = code.length() / i2;
int i5 = code.length() % i2;
String [] arr = new String [i2];
for (int count = 0; count < i5; count ++)
arr[count] = code.substring((i4 + 1) * count, (i4 + 1) * (count + 1));
@wuyongzheng
wuyongzheng / sbibtex.sh
Created May 10, 2011 16:27
search bibtex entries online
#!/bin/bash
if [ $# -eq 0 ] ; then
echo usage $0 '"Visualizing windows system traces"'
exit
fi
query=`urlencode "$1"`
echo liinwww.ira.uka.de:
#include <stdio.h>
void unlockml (unsigned char *dst, const unsigned char *src,
int size, unsigned int key)
{
static const unsigned char shuf[] = {
0xb, 0xc, 0xa, 0x0,
0x8, 0xf, 0x2, 0x1,
0x6, 0x4, 0x9, 0x3,
0xd, 0x5, 0x7, 0xe};