Skip to content

Instantly share code, notes, and snippets.

View leonlee's full-sized avatar
🎯
Focusing

Leon Lee leonlee

🎯
Focusing
  • ACAR
  • Beijing
View GitHub Profile
@championswimmer
championswimmer / C++ Templates vs Java Generics.md
Created July 28, 2018 01:20
C++ Templates vs Java Generics

Templates in C++ vs Generics in Java

Templates and generics allow us to achieve very similar results using very similar code syntax in C++ and Java respectively. But despite that, the implementation of these two features and their semantics are vastly different under the hood.

Syntax and Usage

Templates

Let us consider first the case of a template called Pair in C++.

@leonlee
leonlee / gist:176f565d560df09988ad
Created November 2, 2015 10:51 — forked from fernandoaleman/gist:5083680
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
@staltz
staltz / introrx.md
Last active May 30, 2024 01:44
The introduction to Reactive Programming you've been missing
@brianclements
brianclements / dkcleanup.sh
Last active November 13, 2023 10:49
Bash script helper to remove Docker images and containers.
#!/bin/bash
# options:
# remove stopped containers and untagged images
# $ dkcleanup
# remove all stopped|running containers and untagged images
# $ dkcleanup --reset
# remove containers|images|tags matching {repository|image|repository\image|tag|image:tag}
# pattern and untagged images
# $ dkcleanup --purge {image}
@jayjanssen
jayjanssen / gist:4944530
Last active December 13, 2015 16:58
PXC haproxy config example
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 4096
uid 99
gid 99
daemon
defaults
log global
@madoke
madoke / XSSRequestWrapper.java
Created April 9, 2012 22:23 — forked from ulinkwo/XSSRequestWrapper.java
Stronger Anti Cross-Site Scripting (XSS) Filter for Java Web Apps
package pt.impresa.iweb.filters.request;
import java.io.IOException;
import java.text.Normalizer;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
@fernandoaleman
fernandoaleman / Linux Static IP
Created March 23, 2012 16:20
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@pithyless
pithyless / gist:1208841
Created September 10, 2011 21:49
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...