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
// A little experiment to see if manual memory management is possible in Go | |
package main | |
import "fmt" | |
import "unsafe" | |
import "os" | |
import "syscall" | |
var headerSize = unsafe.Sizeof(Header{}) | |
type Header 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
figure 1 | |
═ ══ | |
3321 | |
═══ | |
figure 2 | |
════ | |
3421 | |
═ ══ |
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
//clang++ -I /usr/local/include/ -L /usr/local/lib/ -lboost_regex boost_re_test.cpp -o test && ./test | |
#include <iostream> | |
#include <string> | |
#include <boost/regex.hpp> | |
int main() | |
{ | |
std::string input("AAAA-12222-BBBBB-44455"); | |
boost::regex re("(\\w+)-(\\d+)-(\\w+)-(\\d+)"); | |
boost::smatch results; |
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
//clang++ -std=c++11 -stdlib=libc++ c11_regex_test.cpp -o test && ./test | |
#include <iostream> | |
#include <string> | |
#include <regex> | |
int main() | |
{ | |
std::string str = "zzxayy--zb"; | |
std::regex re("\\w{0,2}a(.*)?z"); | |
std::smatch m; |
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
// | |
// Clang build cmdline: | |
// $ clang++ ./set.cpp -Wall -Werror -Wfatal-errors -std=c++11 -stdlib=libc++ -o set.out | |
// | |
#include <iostream> | |
#include <unordered_set> | |
struct Point { | |
int x, y; |
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
import os | |
import re | |
print """<?xml version="1.0"?>""" | |
print "<items>" | |
try: | |
query = r"{query}" | |
parts = query.rstrip("/").split("/") | |
filename = parts.pop() |
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
import sqlalchemy | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String | |
from sqlalchemy.orm import sessionmaker | |
# Set this to True to log all actual sql to stdout | |
logging_enabled = False | |
engine = sqlalchemy.create_engine('sqlite:///:memory:', echo=logging_enabled) | |
Session = sessionmaker(bind=engine) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script> | |
(function ($) { | |
$.fn.shuffle = function () { | |
return this.each(function () { | |
var items = $(this).children(); |
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
#!/usr/bin/env python | |
import sys | |
import re | |
import os | |
import time | |
from subprocess import PIPE, Popen | |
from threading import Timer | |
from Queue import Queue, Empty |
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
#include <windows.h> | |
#include <GdiPlus.h> | |
#pragma comment( lib, "gdiplus" ) | |
using namespace Gdiplus; | |
void TakeScreenshot(const WCHAR*, const WCHAR*); | |
bool GetEncoderClsid(const WCHAR*, CLSID*); | |
int main() { |
NewerOlder