Skip to content

Instantly share code, notes, and snippets.

@kwk
kwk / CMakeLists.txt
Last active August 31, 2024 02:57
Fix for "undefined reference to dlopen" in CMake projects
project(testlink)
add_executable(testlink main.cpp)
target_link_libraries(testlink)
@ramntry
ramntry / simple_daytime_server.cpp
Created October 3, 2012 15:07
Simple Boost.Asio based synchronous multithreaded server
#include <ctime>
#include <string>
#include <iostream>
#include <boost/bind.hpp>
#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/format.hpp>
#include <boost/smart_ptr.hpp>
@dvanhorn
dvanhorn / compile-0cfa.rkt
Created October 4, 2012 07:39
Compilation for 0CFA
#lang racket
;; 0CFA in the AAM style, but with a compilation phase, on
;; some hairy Church numeral churning
;; Moral: a simple compilation strategy can eliminate a lot
;; of analysis-time interpretive overhead. (40sec vs 9sec)
;; (X -> Set X) -> (Set X) -> (Set X)
(define ((appl f) s)
@splinterofchaos
splinterofchaos / monad-parser.cpp
Created November 19, 2012 17:32
Monadic parsing in C++
#include <memory>
#include <iostream>
#include <sstream>
#include <utility>
#include <algorithm>
#include <iterator>
struct sequence_tag {};
struct pointer_tag {};
@deekayen
deekayen / 1-1000.txt
Last active May 10, 2025 11:15
1,000 most common US English words
the
of
to
and
a
in
is
it
you
that
@gabrielfalcao
gabrielfalcao / tcp-socket-error-codes-errno.txt
Last active February 19, 2025 18:47
TCP socket error codes
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@doitian
doitian / org-pomodoro.el
Last active February 3, 2018 12:59
org-pomodoro: estimate using # pomodoro, see clocksum using # pomodoro, show timer in modelline TODO: make it a package
(defvar org-pomodoro-minutes 25)
(defvar org-pomodoro-cancelling nil)
(defvar org-pomodoro-command (locate-file "pomodoro" exec-path))
(defun org-pomodoro-on-org-load ()
(push (cons "p" org-pomodoro-minutes) org-effort-durations)
(push '("Effort_ALL" . "1p 2p 3p 4p 5p 6p 7p 8p") org-global-properties)
(define-key org-mode-map "\C-c\C-x'" 'org-pomodoro-columns)
(define-key org-agenda-mode-map "\C-c\C-x'" 'org-pomodoro-agenda-columns))
@ArnonEilat
ArnonEilat / queue.c
Last active December 2, 2021 00:02
Simple C implementation of queue. Usage example included.
#include <stdlib.h>
#include <stdio.h>
#define TRUE 1
#define FALSE 0
/* a link in the queue, holds the info and point to the next Node*/
typedef struct {
int info;
} DATA;
@doobeh
doobeh / example.html
Last active June 8, 2023 18:09
Checkbox WTForms Example (in Flask)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form method="post">
{{ form.hidden_tag() }}
{{ form.example }}