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
# This has been working pretty well for me with: | |
# export KOS_CFLAGS="-Wa,--isa=sh4 -fomit-frame-pointer" | |
# export KOS_AFLAGS="--isa=sh4" | |
# . ${KOS_BASE}/environ_base.sh | |
# cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/dreamcast.cmake.cmake | |
set(CMAKE_SYSTEM_NAME Generic) | |
set(CMAKE_C_COMPILER kos-cc) | |
set(CMAKE_CXX_COMPILER kos-c++) | |
set(CMAKE_ASM_COMPILER kos-as) | |
set(CMAKE_LINKER kos-cc) |
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
// Preprocessor.h ---------------------------- | |
#ifndef __INCLUDED_SCRIPTING_ANGELSCRIPT_PREPROCESSING_H | |
#define __INCLUDED_SCRIPTING_ANGELSCRIPT_PREPROCESSING_H | |
#include <string> | |
#include <vector> | |
class Preprocessor | |
{ | |
public: |
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 test.cpp -lclang -o ./test && ./test | |
// gcc test.cpp -lclang -o ./test && ./test | |
#include "clang-c/Index.h" | |
#include <stdio.h> | |
int main(int argc, char** argv) | |
{ | |
CXIndex idx = clang_createIndex(1, 0); | |
const char *clangargs[] = | |
{ |
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
# Usage: python conv.py < input.txt > output.json | |
import re | |
import sys | |
for line in re.findall(r".*?=([^\"\n]+[^\n]+)", sys.stdin.read()): | |
count = 1 | |
regex = re.compile(r"((\w+)=\"([^\"$\n]+)\")") | |
match = regex.search(line) | |
while match: | |
line = "%s%s=\\\"${%d:%s}\\\"%s" % (line[:match.start()], match.group(2), count, match.group(3), line[match.end():]) |
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
-- tshark -i tap0 -Xlua_script:./script.lua -f "src port 80" -O HTTP > /dev/null | |
function lastfile() | |
local max = 0 | |
for filename in io.popen("ls data/*.mp3"):lines() do | |
local curr = tonumber(string.sub(filename, filename:find("%d+"))) | |
if curr > max then | |
max = curr | |
end |
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/bash | |
startdir=`dirname $0` | |
if [ $# -lt 1 ] | |
then | |
echo "usage: $0 /path/to/your/library.so packagename.of.your.activity" | |
echo " or" | |
echo "usage: $0 /path/to/your/executable" |
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
# Based on @berenm's pull request https://github.com/quarnster/SublimeClang/pull/135 | |
# Create the database with cmake with for example: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. | |
# or you could have set(CMAKE_EXPORT_COMPILE_COMMANDS ON) in your CMakeLists.txt | |
# Usage within SublimeClang: | |
# "sublimeclang_options_script": "python ${home}/code/cmake_options_script.py ${project_path:build}/compile_commands.json", | |
import re | |
import os | |
import os.path |
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
# Based on code originally from http://code.activestate.com/recipes/491264-mini-fake-dns-server/ | |
# | |
# DNS rfc: http://www.ietf.org/rfc/rfc1035.txt | |
# http://en.wikipedia.org/wiki/List_of_DNS_record_types | |
import socket | |
import re | |
import sys | |
import traceback | |
import struct | |
import Queue |
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
-- Compile with ghc -O2 -msse4.2 --make nn -rtsopts | |
-- Run with ./nn False +RTS -s | |
-- ..... | |
-- 812,842,896 bytes allocated in the heap | |
-- 592,620,616 bytes copied during GC | |
-- 63,771,584 bytes maximum residency (11 sample(s)) | |
-- 1,063,968 bytes maximum slop | |
-- 180 MB total memory in use (0 MB lost due to fragmentation) | |
-- | |
-- Tot time (elapsed) Avg pause Max pause |
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
var re = new RegExp("download|subtitle.*srt|class_resources|slides") | |
for (var i in document.links) | |
{ | |
var link = document.links[i].href; | |
if (re.test(link)) { | |
window.open(link); | |
} | |
} |
OlderNewer