Skip to content

Instantly share code, notes, and snippets.

View guiyanzhong's full-sized avatar

guiyanzhong guiyanzhong

View GitHub Profile
@jhezjkp
jhezjkp / .vimrc
Created August 20, 2012 15:52
vim配置
"安装/更新:BundleInstall
"卸载即将对应项注释后再运行:BundleClean
"取消兼容模式
set nocompatible
"关闭文件类型侦测,必须
filetype off
"powerline配置要求
set laststatus=2
"编码设置
@TimSC
TimSC / vlcsms.c
Created November 20, 2012 22:59
Using libvlc to extract raw frames and audio from media via smem
//To compile:
//cc vlcsms.c -o vlcsms -lvlc
//This source is by Tim Sheerman-Chase and it is released as public domain.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <vlc/vlc.h>
@gizmaa
gizmaa / Plot_Examples.md
Last active June 10, 2024 02:44
Various Julia plotting examples using PyPlot
@bryanhunter
bryanhunter / mike_check.erl
Created February 11, 2014 19:10
Simple program to test the performance of a concurrent language.
-module(mike_check).
% The performance of a concurrent language is predicated by three things:
% 1) the context switching time,
% 2) The message passing time,
% 3) and the time to create a process.”
% - Mike Williams
-export([start_and_time/1,start/1, do_it_all/2]).
@justecorruptio
justecorruptio / 2048.c
Created April 4, 2014 03:49
Tiny 2048 in C!
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@joyrexus
joyrexus / README.md
Last active September 1, 2023 02:46
File upload POST with curl

Extracted from this excellent curl tutorial


Back in late 1995 they defined an additional way to post data over HTTP. It is documented in the RFC 1867, why this method sometimes is referred to as RFC1867-posting.

This method is mainly designed to better support file uploads. A form that allows a user to upload a file could be written like this in HTML:

#include <glob.h>
#include <vector>
#include <string>
inline std::vector<std::string> glob(const std::string& pat){
using namespace std;
glob_t glob_result;
glob(pat.c_str(),GLOB_TILDE,NULL,&glob_result);
vector<string> ret;
for(unsigned int i=0;i<glob_result.gl_pathc;++i){
ret.push_back(string(glob_result.gl_pathv[i]));
@zhangjianyu1979
zhangjianyu1979 / vlcsms.c
Last active March 4, 2019 07:59 — forked from TimSC/vlcsms.c
Using libvlc to extract raw frames and audio from media via smem
//To compile:
//cc vlcsms.c -o vlcsms -lvlc
//This source is by Tim Sheerman-Chase and it is released as public domain.
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <vlc/vlc.h>
@JGrossholtz
JGrossholtz / modbus_rs232_master_client.c
Last active May 24, 2024 09:30
A sample libmodbus client / server (master/slave) using RS232 to request data from a modbus client (tested with libmodbus3.0.6)
#include <stdio.h>
#include <unistd.h>
#include <modbus.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <linux/serial.h>
#include <asm/ioctls.h>
#define NB_REGS 2
@Davor111
Davor111 / sshuttle.sh
Created February 17, 2017 08:34
How to use sshuttle with .key, .csr or .pem files for authentication
#It's not directly mentioned in the documentation on how to do this, so here you go. This command will tunnel everything including DNS:
sshuttle --dns -vr user@yourserver.com 0/0 --ssh-cmd 'ssh -i /your/key/path.pem'