Skip to content

Instantly share code, notes, and snippets.

@clintel
clintel / gist:1155906
Created August 19, 2011 02:40
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@smebberson
smebberson / .gitignore
Created January 9, 2012 06:46
Express simple authentication example
node_modules
*.swp
@quietcricket
quietcricket / gist:2521037
Created April 28, 2012 18:20
Get IP Address, C/C++
string getIPAddress(){
string ipAddress="Unable to get IP Address";
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
// retrieve the current interfaces - returns 0 on success
success = getifaddrs(&interfaces);
if (success == 0) {
// Loop through linked list of interfaces
temp_addr = interfaces;
@bricef
bricef / smartystring.c
Last active April 15, 2020 06:56
Dynamically growing a string in C.
#include <stdio.h>
#include <stdlib.h>
#define SMARTY_SIZE_INIT 16
typedef struct {
char * str; // a null terminated C string
char * end; // a pointer to the null byte, to be able to repeatedly append
// without using strlen() every time.
size_t size; // currently allocated size for *str, so we know when we
@andrewlkho
andrewlkho / gist:10739476
Created April 15, 2014 14:59
Patching GNU screen on Mac OS X for vertical split

This was originally posted on 2011-12-18 to http://andrewho.co.uk/weblog/patching-gnu-screen-on-mac-os-x-for-vertical-split

The ability in GNU screen to vertically split a display so that two windows are visible side-by-side (which is what GNU screen means by "vertical split") is not available in the latest stable release (4.0.3). It is, however, available in the latest HEAD slated for screen 4.1. Various distributions such as debian have merged the upstream changes into their stable versions; Mac OS X (10.7) is not one of them. Here's how to compile it in.

First, clone the latest HEAD (450e8f38 at the moment):

@tsl0922
tsl0922 / .tmux.conf
Last active June 21, 2024 02:14
vim style tmux config
# vim style tmux config
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
/// perform the Simplest Color Balancing algorithm
void SimplestCB(Mat& in, Mat& out, float percent) {
assert(in.channels() == 3);
assert(percent > 0 && percent < 100);
float half_percent = percent / 200.0f;
vector<Mat> tmpsplit; split(in,tmpsplit);
for(int i=0;i<3;i++) {
//find the low and high precentile values (based on the input percentile)
@madevelopers
madevelopers / readzip.go
Created January 29, 2015 09:36
golang: Read zip file
package main
import (
"archive/zip"
"fmt"
"io/ioutil"
)
type myCloser interface {
Close() error
@indraniel
indraniel / tar-gz-reader.go
Created February 23, 2015 19:05
Reading through a tar.gz file in Go / golang
package main
import (
"archive/tar"
"compress/gzip"
"flag"
"fmt"
"io"
"os"
)
@Naios
Naios / functional_unwrap.hpp
Last active July 31, 2023 01:53
C++ functional argument unwrap traits. Extracts argument and return types of functions, std:.function and std::tuple's
/*
* Copyright (C) 2015 Naios <naios-dev@live.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,