Skip to content

Instantly share code, notes, and snippets.

@jsfaint
jsfaint / gif2bin.c
Created May 27, 2014 03:10
Convert gif to binary file.
/*
v0.3 implement getFileName(), optimize output file.
v0.2 add multi file support
v0.1 first demo
*/
#include <string.h>
#include <stdio.h>
void getFileName(const char *szFullName, char *szFileName);
@jsfaint
jsfaint / bcd2dec.c
Created May 27, 2014 03:18
BCD code to decimal
#include <stdio.h>
unsigned char bcd2dec(unsigned char c);
unsigned char bcd2dec(unsigned char c)
{
unsigned char dec;
dec = (c>>4) & 0x07;
dec = (dec<<3) + (dec<<1) + (c & 0x0F);
#include <cstdio>
const int max = 65000;
const int lineLength = 12;
void fibonacci( int max )
{
if ( max < 2 )
return;
#include <stdio.h>
#define NO_OF_PORTS 8
#define TRUE 1
#define FALSE 0
static long pow(int x, int y)
{
int ii;
long result = 1;
@jsfaint
jsfaint / parse_ip.c
Created May 27, 2014 03:30
Parse IP address
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
typedef unsigned char u_char;
typedef unsigned char uchar;
typedef unsigned long u_long;
typedef unsigned long ip_addr;
typedef unsigned short ushort;
@jsfaint
jsfaint / gif2c.c
Created May 27, 2014 03:31
Convert gif to C file
/*
* gif2c.c
* convert gif file to c file.
* support multi file one time.
*
* author: jason(jsfaint@gmail.com)
* date: 2009.03.30
*
*/
#include <windows.h>
#include <stdio.h>
BOOL DisplaySystemVersion()
{
OSVERSIONINFOEX osvi;
BOOL bOsVersionInfoEx;
// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
//
@jsfaint
jsfaint / yaDeskView.c
Created June 20, 2014 09:32
Yet Another DeskView
//deskview.exe cosplay
//[2008-09-11 jason jsfaint@gmail.com]
#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pszCmdLine, int cmdShow)
{
HWND hwnd = FindWindowEx(FindWindowEx(FindWindow("Progman", NULL), 0, "SHELLDLL_DefView", NULL), 0, "SysListView32", NULL);
int iStyle = GetWindowLong(hwnd, GWL_STYLE);
/*++
Module Name:
write_ver.c
Abstract:
Add version string in wrp file header for VSC7398.
A part of auto provision function implement.
Author:
jason (jasonjia@net-star.com.cn) Dec-01-2009
@jsfaint
jsfaint / str2IntArry.c
Created June 20, 2014 09:43
implement a fake standard lib function. atoi_fake()
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
typedef unsigned char bool;
typedef unsigned short ushort;
typedef unsigned char uchar;
#define TRUE 1