Skip to content

Instantly share code, notes, and snippets.

View psyomn's full-sized avatar
♥️
HARD WORK AND DISCIPLINE

psyomn

♥️
HARD WORK AND DISCIPLINE
  • Montreal
View GitHub Profile
@psyomn
psyomn / events.json
Created October 30, 2015 01:54
just to make it easier to inspect payloads from different githubarchive events
{
"actor": "ArthurPai",
"actor_attributes": {
"email": "[email protected]",
"gravatar_id": "94937b16f15f3b3b7f2795fe5bd0e49f",
"location": "Taiwan",
"login": "ArthurPai",
"name": "Artuhr",
"type": "User"
},
#include <stdio.h>
#include <stdlib.h>
void my_at_exit(void) {
printf("I am doing things before exiting\n");
}
int main(void) {
atexit(my_at_exit);
@psyomn
psyomn / simplechat.py
Last active August 29, 2015 14:26
crappy insecure python chat server
import threading
from multiprocessing.connection import Listener
from multiprocessing.connection import Client
from array import array
def listen():
address = ('', 50000)
listener = Listener(address)
conn = listener.accept()
@psyomn
psyomn / .vimrc
Created June 30, 2015 19:03
.vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-fugitive' " git integration for things like Gblame
Plugin 'lervag/vimtex'
Plugin 'tpope/vim-rails'
@psyomn
psyomn / .vimrc
Created May 22, 2015 21:42
.vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-fugitive'
Bundle 'lervag/vim-latex'
Plugin 'tpope/vim-rails'
@psyomn
psyomn / sendmsg.py
Last active August 29, 2015 14:20
send messages using multiprocessing lib in python
import sys
from multiprocessing.connection import Client
if len(sys.argv) == 1:
print "Usage:"
print " sendmsg.py <host> <port> <message>"
print " sendmsg.py <message> (default port:5000, host:localhost)"
args = sys.argv[1:]
@psyomn
psyomn / cparser.rs
Created April 1, 2015 06:55
Crappy CSV parser in Rust.
/// Very, very, very, VERY bad CSV parser. If you're wondering, I wrote this because
/// rustc-serializer was not working at some point, and needed a simple parser.
pub fn parse_csv(s : String) -> Vec< Vec<String> > {
let mut buff: String = String::new();
let mut record: Vec<String> = Vec::new();
let mut ret: Vec< Vec<String> > = Vec::new();
for c in s.chars() {
println!("{}.", c);
match c {
@psyomn
psyomn / e.sh
Created November 23, 2014 00:00
airline 256 color fix
# If airline is not having proper colors, add this to your bashrc file
if [ -e /usr/share/terminfo/x/xterm-256color ]; then
export TERM='xterm-256color'
else
export TERM='xterm-color'
fi
@psyomn
psyomn / shorthand.adb
Created October 28, 2014 03:59
Printing shorthand, lolz.
-- Shorthand to print
procedure p(str : Wide_String) renames Ada.Wide_Text_IO.Put_Line;
@psyomn
psyomn / sendudp2.c
Created October 21, 2014 20:09
A nice-y debugging tool if you want to send plain udp packets, and wait for listens
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <netdb.h>
/* somewhat modified version of Paul Kryzanowski's example
* https://www.cs.rutgers.edu/~pxk/417/notes/sockets/udp.html
*/