This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"encoding/json" | |
) | |
type js struct { | |
A map[string]interface{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An OpenGL3 Exmaple: glew, glfw and nanovg. | |
// 2D and 3D in same scene. Torus is drawn with static display list. | |
#include <stdlib.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include "GL/glew.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Draw rotating Torus with GLFW3 | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
#include <GLFW/glfw3.h> | |
static void drawTorus(int numMajor, int numMinor, float majorRadius, float minorRadius) | |
{ | |
static double PI = 3.1415926535897932384626433832795; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copyFileSync(srcFile, destFile) { | |
var BUF_LENGTH, buff, bytesRead, fdr, fdw, pos; | |
BUF_LENGTH = 64 * 1024; | |
buff = new Buffer(BUF_LENGTH); | |
fdr = fs.openSync(srcFile, 'r'); | |
fdw = fs.openSync(destFile, 'w'); | |
bytesRead = 1; | |
pos = 0; | |
while (bytesRead > 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<!-- from https://github.com/airbnb/airpal/blob/master/src/main/resources/assets/index.html > | |
<!-- to avoid being banded by GFW --> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
<script>window.jQuery || document.write('<script src="app/javascripts/vendor/jquery-1.9.0.min.js"><\/script>')</script> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def deleteFile(dfile : File) : Unit = { | |
if(dfile.isDirectory){ | |
val files = dfile.listFiles | |
if(files != null) | |
files.foreach{ f => deleteFile(f) } | |
} | |
dfile.delete | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git clone will give you the whole repository. | |
# After the clone, you can list the tags with git tag -l; | |
# then checkout a specific tag: git checkout tags/<tag_name> | |
git clone <repo-address> | |
git tag -l | |
git checkout <tag-name> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// borrowed from http://www.cnblogs.com/duanhuajian/p/4485106.html | |
// change: use utc time instead | |
function formatDate (date, fmt) { | |
var o = { | |
"M+" : date.getUTCMonth()+1, | |
"d+" : date.getUTCDate(), | |
"h+" : date.getUTCHours()%12 == 0 ? 12 : date.getUTCHours()%12, | |
"H+" : date.getUTCHours(), | |
"m+" : date.getUTCMinutes(), | |
"s+" : date.getUTCSeconds(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
"net/http/httputil" | |
"net/url" | |
) | |
type handle struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# https://www.blackmoreops.com/2014/10/28/delete-clean-cache-to-free-up-memory-on-your-slow-linux-server-vps/ | |
sync | |
sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches" |
OlderNewer