Skip to content

Instantly share code, notes, and snippets.

View patrickelectric's full-sized avatar
🏡
Working from home

Patrick José Pereira patrickelectric

🏡
Working from home
View GitHub Profile
@filsinger
filsinger / main.cpp
Created October 18, 2012 09:06
C++11 : Split a string using regex
#include <regex>
#include <string>
#include <vector>
std::vector<std::string> Split(const std::string& str, const std::string& regex)
{
return {std::sregex_token_iterator(str.begin(), str.end(), std::regex(regex), -1), std::sregex_token_iterator()};
}
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 2, 2024 11:04
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tugstugi
tugstugi / gist:2627647
Created May 7, 2012 13:03
v4l: camera capability and control query
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/videodev2.h>
int main() {
int N = 100;
char* deviceName = "/dev/video0";
int fd = open(deviceName, O_RDWR);

A good commit message looks like this:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
@zbyhoo
zbyhoo / count_gcc_warnings.sh
Created April 27, 2011 12:09
Sorts and counts all warnings from gcc compilation output
#!/bin/bash
if [ "$#" != "1" ]
then
echo wrong number of arguments
echo Usage: $0 \<filename\>
echo filename - file with build output
exit 1
else
cat $1 | grep "warning:" | sort | uniq -c | sort -nr | awk '{print $0}{total+=1}END{print "Total number of warnings:\n"total}'
@bellbind
bellbind / genetic.py
Created December 15, 2010 10:46
[python]Genetic Algorithm example
"""Genetic Algorithmn Implementation
see:
http://www.obitko.com/tutorials/genetic-algorithms/ga-basic-description.php
"""
import random
class GeneticAlgorithm(object):
def __init__(self, genetics):
self.genetics = genetics
pass