Skip to content

Instantly share code, notes, and snippets.

View hao-lee's full-sized avatar

Hao Li hao-lee

  • China
View GitHub Profile
@julianlam
julianlam / gist:3a2d0bd6720ac2f45bef
Created September 3, 2014 18:02
Allowing NodeBB to serve all static assets
server {
listen 80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;
# Socket.IO Support
@bert
bert / gist:267960
Created January 3, 2010 12:42
GTK expose event and handler example
/*!
* \file
* \brief
*/
#include <gtk/gtk.h>
/*!
@qlyoung
qlyoung / linux-clang-format
Created July 17, 2017 18:37
Linux kernel style .clang-format
---
BasedOnStyle: LLVM
Language: Cpp
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AlwaysBreakBeforeMultilineStrings: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
@fcwu
fcwu / hello.py
Created June 17, 2013 03:34
python, gtk 3 and CSS
#!/usr/bin/python3
from gi.repository import Gtk, Gdk
import sys
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Hello World")
self.set_name('MyWindow')
@rodneyrehm
rodneyrehm / gist:40e7946c0cff68a31cea
Last active November 7, 2022 09:11
Diagrams for Documentation

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

@duhaime
duhaime / measure_img_similarity.py
Last active March 1, 2023 08:41
Compare image similarity in Python using Structural Similarity, Pixel Comparisons, Wasserstein Distance (Earth Mover's Distance), and SIFT
import warnings
from skimage.measure import compare_ssim
from skimage.transform import resize
from scipy.stats import wasserstein_distance
from scipy.misc import imsave
from scipy.ndimage import imread
import numpy as np
import cv2
##
@gjorquera
gjorquera / console.cpp
Last active February 4, 2024 12:44
Qt way to read from stdin.
#include <iostream>
#include "console.hpp"
void Console::run()
{
std::cout << "First message" << std::endl;
std::cout << "> " << std::flush;
connect(m_notifier, SIGNAL(activated(int)), this, SLOT(readCommand()));
}
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@rocarvaj
rocarvaj / .vimrc
Created April 27, 2012 21:28
Minimal .vimrc for C/C++ developers
" VIM Configuration File
" Description: Optimized for C/C++ development, but useful also for other things.
" Author: Gerhard Gappmeier
"
" set UTF-8 encoding
set enc=utf-8
set fenc=utf-8
set termencoding=utf-8
" disable vi compatibility (emulation of old bugs)
@stek29
stek29 / prettyflags.py
Last active May 1, 2024 15:44
Pretty print x86 (r|e)flags register with lldb script
import lldb
import shlex
FLAGS = [
['CF', 'Carry Flag'],
[None, 'Reserved'],
['PF', 'Parity Flag'],
[None, 'Reserved'],
['AF', 'Adjust Flag'],
[None, 'Reserved'],