Skip to content

Instantly share code, notes, and snippets.

View aahung's full-sized avatar
🔨

_sam aahung

🔨
View GitHub Profile
@aahung
aahung / xsitemapgenerator.md
Last active August 29, 2015 14:18
XSitemapGenerator
@aahung
aahung / bash_deviceQuery.sh
Created July 16, 2015 01:43
run deviceQuery of CUDA on all compute nodes
for i in {1..16}; do ssh compute-0-${i} /share/apps/cuda/samples/1_Utilities/deviceQuery/deviceQuery; done
@aahung
aahung / AA Pay Calculator Input
Last active August 29, 2015 14:25
AA Pay Calculator
X 38 #July 1st Taxi
$ (0, []),
T 6.74 #July 7th Super Fresh Asian Market
$ (0, []),
T 37.922 #July 7th Superstore
$ (10.85, [M, C, W]), (0, []),
M 20 #July 9th 711
@aahung
aahung / icpc_4966.cpp
Last active October 3, 2015 10:59
ICPC 4966
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef struct node_t {
vector<int> values;
vector<node_t *> e_values;
int evaluate;
@aahung
aahung / 4964.cpp
Last active October 10, 2015 01:58
ICPC Regionals 2010 :: Africa/Middle East - Arab Contest
//
// main.cpp
// testing1
//
// Created by Xinhong LIU on 17/5/14.
// Copyright (c) 2014 Xinhong LIU. All rights reserved.
//
#include <iostream>
#include <fstream>
@aahung
aahung / 4157.cpp
Last active October 10, 2015 08:42
ICPC Regionals 2008 >> Asia - Aizu
#include <stdio.h>
#include <string.h>
//#define DEBUG
int n;
int w;
int histo[12]; // since at most 10 intervals
int main() {
@aahung
aahung / 6113.cpp
Last active October 17, 2015 10:46
ICPC Regionals 2012 :: Asia - Daejeon
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
int case_n;
scanf("%d", &case_n);
while (case_n--) {
int v_a, v_b;
@aahung
aahung / 5723.cpp
Created October 24, 2015 10:43
ICPC Regionals 2011 :: Asia - Phuket
#include <stdio.h>
#define INFINITE 18446744073709551615
typedef unsigned long long ull;
int n;
ull flow[21];
ull cost[21];
ull minimal_cost;
@aahung
aahung / Difference Between Memory Ballooning and Memory Swapping.md
Created December 4, 2015 07:10
Difference Between Memory Ballooning and Memory Swapping

Difference Between Memory Ballooning and Memory Swapping

When memory scares

  • Memory ballooning will ask the virtual machine to select it's idle memory pages to be swapped.
  • Memory swapping will brutally picks pages at random from the virtual machine.

So memory swapping often occurs when memory ballooning cannot effective free the memory, it will impacts the performance more.

@aahung
aahung / onload.js
Created December 4, 2015 16:05
Change external links' target = '_blank'
$(function(argument) {
// set target=_blank for all external links
// credit: http://stackoverflow.com/questions/2910946/test-if-links-are-external-with-jquery-javascript
var nodes = document.getElementsByTagName("a"), i = nodes.length;
var regExp = new RegExp("//" + location.host + "($|/)");
while (i--) {
var href = nodes[i].href;
var isLocal = (href.substring(0,4) === "http") ? regExp.test(href) : true;
if (!isLocal)
nodes[i].target = "_blank";