Skip to content

Instantly share code, notes, and snippets.

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

psyomn

♥️
HARD WORK AND DISCIPLINE
View GitHub Profile
@mkroman
mkroman / Network.cpp
Created November 17, 2011 01:42
Uncrustify configuration inspired by Google's C++ styleguide.
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#include <iostream>
#include <stdarg.h>
#include <stdio.h>
@smoil
smoil / account.rb
Last active March 2, 2020 00:32
Ajax select/multi select in Rails using Select2
class Account < ActiveRecord::Base
def self.search(name = nil)
# search logic
end
end
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
typedef int i; //Save space by using 'i' instead of 'int'
typedef float f; //Save even more space by using 'f' instead of 'float'
//Define a vector class with constructor and operator: 'v'
struct v {
f x,y,z; // Vector has three float attributes.
char *f="char *f=\"$\";\n"
"char buf[65536];\n"
"char in[65536];\n"
"char *sub_copy(char *b){\n"
"char *a=f;\n"
"for(;*a;a++)switch(*a){\n"
"case 10:*b++=92;*b++=110;*b++=34;*b++=10;*b++=34; break;\n"
"case 34:\n"
"case 92:*b++=92;\n"
"default:*b++=*a;\n"
@nikhan
nikhan / twitter.sh
Created January 1, 2016 04:45
twitter ffmpeg
ffmpeg -i test.mov -vcodec libx264 -vf 'scale=640:trunc(ow/a/2)*2' -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -strict experimental -r 30 out.mp4
@ictlyh
ictlyh / producer-consumer
Created November 30, 2016 10:55
Producer and consumer demo in concurrent queue. c++ multi-threading.
// concurrent-queue.h
#ifndef CONCURRENT_QUEUE_H_
#define CONCURRENT_QUEUE_H_
#include <queue>
#include <thread>
#include <mutex>
#include <condition_variable>
template <typename T>