Skip to content

Instantly share code, notes, and snippets.

View stuaxo's full-sized avatar
💭
 

Stuart Axon stuaxo

💭
 
View GitHub Profile
@stuaxo
stuaxo / rec_to_mp3.cmd
Created November 15, 2014 23:48
VLC - transcode .rec to mp3.
vlc -I dummy -vvv %1 --sout=#transcode{acodec="mp3",ab="512","channels=2"}:standard{access="file",mux="raw",dst="%~n1.mp3"} vlc://quit
@stuaxo
stuaxo / vext_test.py
Created February 13, 2015 15:07
Testing vext
if __name__ == '__main__':
try:
for name in ['cairo', 'gtk', 'pygtk', 'hello']:
try:
m = __import__(name)
print '%s: %s' % (name, m)
except Exception as e:
print '%s: %s' % (e.__class__.__name__, str(e))
print ''
@stuaxo
stuaxo / setup.py
Last active August 29, 2015 14:16
Install file to site_packages root on windows as well as linux
"""
Install a file into the root of sitepackages on windows as well as linux.
Under normal operation on win32 path_to_site_packages
gets changed to '' which installs inside the .egg instead.
"""
import os
from distutils import sysconfig
@stuaxo
stuaxo / field_linux64_bork.txt
Last active August 29, 2015 14:17
Field64 bork.txt
./field_linux64_mozilla.sh
/home/stu/projects/external/Field/Contents/linux/..
rm: cannot remove ‘../core/classes/org/eclipse/swt’: No such file or directory
Listening for transport dt_socket at address: 5555
hello
## trampoline <class field.bytecode.protect.StandardTrampoline:sun.misc.Launcher$AppClassLoader@6f171e30>
warning: wildcard path </home/marc/fieldwork/personal/classpath/**> is not a directory or does not exist
warning, path </home/stu/projects/external/Field/Contents/linux/../extensions/../extras/syphon/bin>added to classpath through Field-RedirectionPath inside extension /home/stu/projects/external/Field/Contents/linux/../extensions/syphon.mf doesn't exist
warning, path </home/stu/projects/external/Field/Contents/linux/../extensions/../extras/gstreamer/bin>added to classpath through Field-RedirectionPath inside extension /home/stu/projects/external/Field/Contents/linux/../extensions/gstreamer.mf doesn't exist
warning, path </home/stu/projects/external/Field/Contents/linux/../extensions/..
@stuaxo
stuaxo / no_draw_if_gi_is_symlink.py
Created April 20, 2015 15:59
Draw events do not happen if 'gi' is a symlink
@stuaxo
stuaxo / create_toolchain.sh
Last active August 29, 2015 14:23
Create android standalone toolchains
#!/bin/bash
# Either pass in the dest directory, or will install to current dir
# from
# https://gist.github.com/bongole/304a006a5386220246aa
for arch in armv7-a x86 x86_64; do
echo "Create standalone for $arch"
case $arch in
arm*)
@stuaxo
stuaxo / get_orig_prefix.py
Created July 11, 2015 16:22
Get orig prefx in virtualenv
def get_orig_prefix():
"""
read orig-prefix.txt and return it
"""
orig_prefix_txt = normpath(abspath(join(get_python_lib(), '..', 'orig-prefix.txt')))
print orig_prefix_txt
try:
with open(orig_prefix_txt) as f:
path = f.readline().strip()
return path
@stuaxo
stuaxo / parse_ldsoconf.py
Last active August 26, 2022 01:19
Parse ld.so.conf and get all the directories from it
from os.path import abspath, isabs, join
from glob import glob
def parse_ldsoconf(filename="/etc/ld.so.conf"):
paths = set()
directory = dirname(abspath(filename))
with open(filename) as f:
for line in (_line.rstrip() for _line in f.readlines()):
if line.startswith("include "):
wildcard = line.partition("include ")[-1:][0].rstrip()
@stuaxo
stuaxo / csgthing.py
Created July 25, 2015 11:55
What happens if we csg in the draw loop ?
import sys
import os
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
sys.path.insert(0, os.getcwd())
from csg.core import CSG
@stuaxo
stuaxo / cairocffi_example.py
Created August 8, 2015 13:37
Draw a yellow rectangle in cairocffi
# coding: utf-8
# In[12]:
# draw a yellow rectangle with cairocffi
import cairocffi as cairo
im = cairo.ImageSurface(cairo.FORMAT_ARGB32, 512, 512)