Skip to content

Instantly share code, notes, and snippets.

View Logmos's full-sized avatar
🌴
On vacation

Logmos

🌴
On vacation
View GitHub Profile
@bert
bert / gist:267960
Created January 3, 2010 12:42
GTK expose event and handler example
/*!
* \file
* \brief
*/
#include <gtk/gtk.h>
/*!
@bert
bert / insert_text_handler.c
Created November 4, 2010 21:30
Validate input to a GtkEntry
/*!
* If you want to validate the text that a user enters into a GtkEntry widget
* you can attach to the "insert_text" signal of the entry, and modify the text
* within the callback function.\n
* The example below forces all characters to uppercase, and limits the range of
* characters to A-Z.\n
* Note that the entry is cast to an object of type GtkEditable, from which
* GtkEntry is derived.
*/
@CocoaBeans
CocoaBeans / gdbinit
Created February 21, 2012 21:58
.gdbinit - A user-friendly gdb configuration file
# INSTALL INSTRUCTIONS: save as ~/.gdbinit
#
# DESCRIPTION: A user-friendly gdb configuration file.
#
# REVISION : 7.3 (16/04/2010)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
#
# FEEDBACK: https://www.reverse-engineering.net
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@rmartinho
rmartinho / hate.markdown
Last active July 15, 2020 01:33
I will hate you

Dear C++ library writer,

  1. If your library forces me to use new all over, I will hate you.

  2. If your library has types with bogus values, I will hate you.

  3. If the documentation for your library gets the terminology of its own domain wrong, I will hate you.

  4. If I say "My God, it's full of stars!" when I see the function signatures in your library, I will hate you.

@jdeng
jdeng / queens.cc
Created December 11, 2013 16:48
N Queens Problem (N <= 16)
//compile with -Ofast -march=native -funroll-loops
#include <stdio.h>
typedef unsigned short uint16_t;
template <int n, int m>
struct queens {
static void f(uint16_t col, uint16_t left, uint16_t right, size_t& count) {
uint16_t mask = ~(col | left | right);
for (int i = 0; i < n; ++i, mask >>= 1) {
@melvincabatuan
melvincabatuan / latex install
Created August 25, 2015 23:45
Centos 7 latex install
yum -y install texlive texlive-latex texlive-xetex
yum -y install texlive-collection-latex
yum -y install texlive-collection-latexrecommended
yum -y install texlive-xetex-def
yum -y install texlive-collection-xetex
Only if needed:
yum -y install texlive-collection-latexextra
@mbinna
mbinna / effective_modern_cmake.md
Last active May 2, 2025 03:17
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@MattPD
MattPD / cpp.std.coroutines.draft.md
Last active April 10, 2025 13:50
C++ links: Coroutines (WIP draft)
@OneRaynyDay
OneRaynyDay / Makefile
Created February 20, 2020 19:45
Tensorflow C++ API sandboxing
# Change BASE_DIR accordingly.
BASE_DIR=/Users/ray_zhang/home/tensorflow/bazel-bin
INC=-I$(BASE_DIR)/tensorflow/include -I$(BASE_DIR)/tensorflow -I$(BASE_DIR)/tensorflow/include/src/
LIB=-L$(BASE_DIR)/tensorflow -rpath $(BASE_DIR)/tensorflow -ltensorflow_cc -ltensorflow_framework
FLAGS=-std=c++14
main: deserialize.cpp
g++ $(FLAGS) $(INC) $(LIB) -o deserialize $^