Skip to content

Instantly share code, notes, and snippets.

View wention's full-sized avatar

WENTION wention

View GitHub Profile
@wention
wention / Base64.c
Created November 22, 2013 09:53
Base64 encode and decode
#include <stdlib.h>
#include <string.h>
/*
** modified by wention 11.22.2013
**
** more information about original please visite http://base64.sourceforge.net/
**
*/
@wention
wention / hex.cpp
Created November 22, 2013 17:54
converte binary to hex,or hex to binary
/*
* create by wention 11,23,2013
*/
#define NaN 255
char decode_table[] = "0123456789ABCDEF";
//char decode_table1[] = "0123456789abcdef";
unsigned char encode_table[] = {0,1,2,3,4,5,6,7,8,9,NaN,NaN,NaN,NaN,NaN,NaN,NaN,10,11,12,13,14,15};
void binary_to_hex( unsigned char* binary, //a point of data need to be convert
@wention
wention / option_templete.sh
Created December 2, 2015 02:07 — forked from babarot/option_templete.sh
Command line option parser templete for bash
#!/bin/bash
PROGNAME=$(basename $0)
VERSION="1.0.0"
usage() {
echo "Usage: $PROGNAME [OPTIONS] [FILE]"
echo " This script is ~."
echo
echo "Options:"
import __builtin__
openfiles = set()
oldfile = __builtin__.file
class newfile(oldfile):
def __init__(self, *args):
self.x = args[0]
print "\033[01;31m##### %d #### OPENING %s ###\033[00m" % (len(openfiles),str(self.x))
@wention
wention / isotope.pkgd.js
Created May 27, 2016 05:58
isotope compatible with semantic ui v2.1.8 (no shaking)
/*!
* Isotope PACKAGED v3.0.0
*
* Licensed GPLv3 for open source use
* or Isotope Commercial License for commercial use
*
* http://isotope.metafizzy.co
* Copyright 2016 Metafizzy
*/
#include <stdio.h>
#include <string.h>
#include <pulse/pulseaudio.h>
// Field list is here: http://0pointer.de/lennart/projects/pulseaudio/doxygen/structpa__sink__info.html
typedef struct pa_devicelist {
uint8_t initialized;
char name[512];
uint32_t index;
char description[256];
@wention
wention / hash.c
Created December 10, 2016 08:23 — forked from tonious/hash.c
A quick hashtable implementation in c.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
struct entry_s {
char *key;
char *value;
@wention
wention / Xresources
Created December 11, 2016 09:29 — forked from tuhaihe/Xresources
Xterm configure file ~/.Xresources, add Chinese font support
!xrdb ~/.Xresources
!xterm font and locale
xterm.locale:true
xterm.utf8: true
xterm*utf8Title:true
xterm*fontMenu*fontdefault*Label:Default
xterm*faceName:Menlo:antialias=true:pixelsize=13
xterm*faceNameDoublesize:WenQuanYi Micro Hei Mono:pixelsize=13:antialias=true
@wention
wention / gen_crypt_passwd.py
Created August 26, 2017 08:34
generate kickstart rootpw
# -*- coding: utf-8 -*-
import os
import sys
import base64
import crypt
'''
If salt is a character string starting with the characters "$id$" fol‐
lowed by a string terminated by "$":