Skip to content

Instantly share code, notes, and snippets.

View skynowa's full-sized avatar
:octocat:

skynowa skynowa

:octocat:
View GitHub Profile
/*
* Compile with -lxcb -lxcb-randr
*/
#include <stdio.h>
#include <stdlib.h>
#include <xcb/xcb.h>
#include <xcb/randr.h>
int main() {
@skynowa
skynowa / inotify-example.cpp
Created December 26, 2017 15:23 — forked from pkrnjevic/inotify-example.cpp
This simple inotify sample monitors changes to "./tmp". Recursive monitoring of file and directory create and delete events is implemented, but monitoring pre-existing "./tmp" subfolders is not. A C++ class containing a couple of maps is used to simplify monitoring. The Watch class is minimally integrated, so as to leave the main inotify code ea…
//
// File: inotify-example.cpp
// Date: July 16, 2013
// Author: Peter Krnjevic <[email protected]>, on the shoulders of many others
//
// This is a simple inotify sample program monitoring changes to "./tmp" directory (create ./tmp beforehand)
// Recursive monitoring of file and directory create and delete events is implemented, but
// monitoring pre-existing "./tmp" subfolders is not.
// A C++ class containing a couple of maps is used to simplify monitoring.
// The Watch class is minimally integrated, so as to leave the main inotify code
@skynowa
skynowa / install-watchman.sh
Created December 8, 2017 19:32 — forked from ivan-loh/install-watchman.sh
Watchman ( 4.9.0 ) installation for Ubuntu 16.04
# checkout, compile & install
git clone https://github.com/facebook/watchman.git
cd watchman/
git checkout v4.9.0
sudo apt-get install -y autoconf automake build-essential python-dev libssl-dev libtool
./autogen.sh
./configure
make
sudo make install
@skynowa
skynowa / signal.c
Created August 17, 2016 13:22 — forked from aspyct/signal.c
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* [email protected]
* http://aspyct.org
* @aspyct (twitter)
*
* Hope it helps :)
*/
#include <stdio.h>
@skynowa
skynowa / common.h
Created August 17, 2016 13:22 — forked from aspyct/common.h
Unix semaphore with the C programming language, tested under Debian
#ifndef _COMMON_H_
#define _COMMON_H_
#define SEM_KEY_FILE ("sem.key")
#endif /* _COMMON_H_ */
@skynowa
skynowa / cpp11_cond_variable_example.cpp
Created July 8, 2016 09:33 — forked from juehan/cpp11_cond_variable_example.cpp
Consumer - producer example using C++11 thread
#include <condition_variable>
#include <mutex>
#include <future>
#include <iostream>
#include <chrono>
#include <queue>
bool isReady;
std::mutex mutex;
std::condition_variable condvar;
/**
* \file stack_traces.c
* \brief
*
* Compile with:
* on linux: gcc -g stack_traces.c
* on OS X: gcc -g -fno-pie stack_traces.c
* on windows: gcc -g stack_traces.c -limagehlp
*/
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@skynowa
skynowa / sotext
Created October 8, 2013 10:35 — forked from pavanky/sotext
I have to be frank here, this is going to be
- criticism of thrust
- Showing off ArrayFire (of which I am a core developer)
*Criticism of thrust*
They do a good job at optimizing parallel algorithms for vector inputs.
They use data level parallelism (among other things) to parllelize algorithms that work really well for large, vector inputs.
But they fail to improve upon it and go all the way to perfom true data level parallelism. i.e. a large number of small problems.

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after