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
AttrType[] find_attributes(AttrType, alias Thing)() | |
{ | |
AttrType[] result; | |
foreach(attr; __traits(getAttributes, Thing)) | |
static if(is(typeof(attr) == AttrType)) | |
result ~= [attr]; | |
return result; | |
} |
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 gl3n.util: is_matrix, is_vector; | |
auto to_gfm(MatrixType)(MatrixType matrix) | |
if(is_matrix!MatrixType) | |
{ | |
static import gfm.math; | |
enum matrixSize = matrix.cols * matrix.rows; | |
matrix.mt[matrixSize] data; | |
matrix.mt *ptr = matrix.value_ptr; |
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
string string_prompt(Window parent, string prompt, string initialValue = null) | |
{ | |
string result; | |
auto window = new Window(parent, "Prompt"); | |
auto label = new Label(window, prompt); | |
auto input = new Entry(window); | |
auto okButton = new Button(window, "OK"); | |
auto cancelButton = new Button(window, "Cancel"); | |
void close(CommandArgs _ = CommandArgs.init) |
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 | |
cacheFile=~/bin/updates.cache | |
cacheFileNew=~/bin/updates-new.cache | |
function getignores() | |
{ | |
#list ignored packages here, like so: | |
#echo "packagename" | |
#TODO: actually parse pacman.conf |
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
void ensure_throws(ExceptionType = Exception)(void delegate() callable, string message = "") | |
{ | |
import core.exception: AssertError; | |
try | |
{ | |
callable(); | |
assert(false, message); | |
} | |
catch(ExceptionType err) {} |
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
//adapted from http://stackoverflow.com/a/7262117 | |
private real noise(long x, long y) | |
{ | |
long initial = x + y * 57; | |
initial = (initial << 13) ^ initial; | |
real intermediate = ( | |
1.0L - ( | |
( | |
result * ( | |
result ^^ 2 + 15731 + 789221 |
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
--- PKGBUILD.old 2015-03-31 06:59:59.000000000 -0700 | |
+++ PKGBUILD 2015-04-01 08:00:47.770024293 -0700 | |
@@ -16,10 +16,12 @@ | |
build() { | |
cd "$srcdir/sdk/$pkgname/projects/gnuc" | |
- sed -i -e "/^LOCAL/s:=.*:=${pkgdir}/usr:" makefile | |
+ sed -i -e "/^LOCAL/s:=.*:=${pkgdir}/usr:" Makefile | |
+ sed -i -e "s/)_s/)/g" Makefile | |
+ sed -i -e "s/^\t\$(MAKE) install_shared$//g" Makefile |
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 | |
if [ -z "$@" ]; then | |
echo "./record.sh <filename.webm>" | |
exit 1 | |
fi | |
SELECTION=`xrectsel` | |
INRES=`echo $SELECTION | cut -d"+" -f1` | |
WIDTH=`echo $INRES | cut -d"x" -f1` |
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 gzip | |
import sys | |
import pynbt | |
def main(): | |
if len(sys.argv) < 2: | |
print "list.py <agedata_x.dat>" | |
return |
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 difflib | |
import gzip | |
import sys | |
import pynbt | |
def main(): | |
if len(sys.argv) < 2: | |
print "diff.py <agedata_x.dat>" | |
OlderNewer