Skip to content

Instantly share code, notes, and snippets.

Avatar
✔️
Not a virus

Rémy F. yne

✔️
Not a virus
View GitHub Profile
@yne
yne / ftp_proxy.c
Created Dec 18, 2015
Offer an active FTP interface over a passiv FTP server
View ftp_proxy.c
#include <stdlib.h>//exit
#include <stdio.h>
#include <pthread.h>
#include <netdb.h> //NI_NUMERICHOST
#include <string.h>//strlen
#include <unistd.h>//read write close fork
#define ss2sa(ss) ((struct sockaddr *)(ss))
#define $(X) if((err=(X))<0)die(__LINE__,err)
#define Write(A,B) write(A,B,strlen(B))
#define Read(A,B) len=read(A,B,sizeof(B));buf[len]=0;
@yne
yne / xlc.c
Created Dec 18, 2015
XMPP Lightweight Client
View xlc.c
/* libstroph build under win+tcc reminder
tcc -I. src/ctx.c src/snprintf.c src/sock.c src/tls_schannel.c src/util.c src/auth.c src/conn.c src/event.c src/handler.c src/hash.c src/jid.c src/md5.c src/sasl.c src/scram.c src/sha1.c src/stanza.c src/thread.c src/parser_expat.c -lws2_32 -ladvapi -lwinmm -lexpat -shared -rdynamic -o libstroph.dll
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <windows.h>
@yne
yne / bms_player_sdl.c
Created Dec 18, 2015
Easily hackable SDL based BMS player
View bms_player_sdl.c
/*
http://bm98.yaneu.com/bm98/bmsformat.html
http://fileformats.wikia.com/wiki/Be-Music_Script
http://mrqqn.net/dotclear/public/beatmaker/bms-specification.txt
http://hitkey.nekokan.dyndns.info/cmds.htm
*/
#include <malloc.h>
#include <string.h>
#include <fcntl.h>
#include <SDL/SDL.h>
@yne
yne / win_cgi.c
Created Dec 18, 2015
Barebone CGI server for Windows
View win_cgi.c
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
char page[]="HTTP/1.0 200 OK\n\n"
"<!doctype html>"
"<html>"
@yne
yne / gluminess.c
Created Dec 19, 2015
Luminess in pure OpenGL
View gluminess.c
#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/wglext.h>
#include <sys/time.h>
#define COUNT(A) (sizeof(A)/sizeof(A[0]))
#define BLOC_EXIST (1<<0)
#define BLOC_COLOR (1<<1)
@yne
yne / bin_extract.c
Created Dec 20, 2015
Extract from a blob using file header
View bin_extract.c
#include <stdio.h>
#include <string.h>
char* headers[]={
"ID3",
"GIF89",
"‰PNG",
"OggS",
"ÿØÿà",
"BM6x",
@yne
yne / bin_extract.html
Created Dec 20, 2015
Extract files from a blob using file headers
View bin_extract.html
<html>
<head>
<meta charset="utf8">
<script>
var $ =document.querySelector.bind(document);
var $$=document.querySelectorAll.bind(document);
var magic=[
[[ 73, 68, 51 ],"mp3"],
[[ 71, 73, 70, 56, 57],"gif"],
@yne
yne / sudoku_solver.html
Created Dec 20, 2015
Basic Sudoku Solver
View sudoku_solver.html
<html>
<head>
<meta charset="utf8">
<meta content="width=device-width, user-scalable=no" name="viewport"/>
<script>
$$=function(sel){return [].slice.call(document.querySelectorAll(sel))}
function formSolve(){
var grid=(new Grid($$('input').map(function(e){return +e.value}))).solve();
$$('input').forEach(function(input,i){
input.title=grid.grid[i];
@yne
yne / xml_parser.html
Created Dec 20, 2015
Minimalist (<100 line) regexp based XML parser+selector
View xml_parser.html
<html>
<head>
<title>XMLparser</title>
<script>
var XMLparser=function(xml){
//parsing part
this.stack=[];
this.obj={childNode:[]};
this.getLastChild=function(i){
var pos=this.obj;
@yne
yne / gl_ring.js
Created Dec 31, 2015
WebGL Rotating Rings IIDX 20 style
View gl_ring.js
function Ring(n,size,width,tex,repeat,speed){
v=[],t=[];
for(var i=0;i<n;i++){
var rad=2*Math.PI*i/n;
v.push(
size*Math.cos(rad),
size*Math.sin(rad),
0,
You can’t perform that action at this time.