Skip to content

Instantly share code, notes, and snippets.

View whateverforever's full-sized avatar

max whateverforever

View GitHub Profile
@oscar-broman
oscar-broman / gist:3653399
Created September 6, 2012 09:05
UTF8 encode array/object structure in PHP
<?php
function utf8_encode_deep(&$input) {
if (is_string($input)) {
$input = utf8_encode($input);
} else if (is_array($input)) {
foreach ($input as &$value) {
utf8_encode_deep($value);
}
unset($value);
@Answeror
Answeror / gist:3832085
Created October 4, 2012 08:02
Activate virtualenv in blender
def activate_virtualenv(name):
"""Activate given virtualenv.
Virtualenv home folder is given by environment variable ``WORKON_HOME`` or
``~/Envs`.
"""
if 'WORKON_HOME' in os.environ:
home = os.environ['WORKON_HOME']
else:
home = os.path.expanduser(os.path.join('~', 'Envs'))
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@pstaender
pstaender / remove_pdf_password.sh
Created November 11, 2013 12:07
Remove password from protected PDF file with GhostScript
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf
@mitchwongho
mitchwongho / Docker
Last active June 26, 2024 07:28
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@jeromerobert
jeromerobert / pandoc-svg.py
Last active September 1, 2023 09:05
Pandoc filter to create PDF files from SVG
#! /usr/bin/env python
"""
Pandoc filter to convert svg files to pdf as suggested at:
https://github.com/jgm/pandoc/issues/265#issuecomment-27317316
"""
__author__ = "Jerome Robert"
import mimetypes
import subprocess
@dcommander
dcommander / Makefile
Last active April 2, 2024 10:12
Simple program to demonstrate OpenGL rendering without an X server
all: egltest
egltest: egltest.c
cc -O3 -Wall -Werror -I. -o $@ $^ -lOpenGL -lEGL
clean:
rm -f *.o egltest
@andyneff
andyneff / egl_notes.md
Created December 29, 2017 16:54
EGL Notes.md

Gotchas

  • Nvidia Driver 375.39 on ubuntu is broken when it comes to EGL. Follow comment #11 to fix the host machine.
    • To fix an nvidia-docker driver mount, you need to either fix /var/lib/nvidia-docker/volumes/nvidia_driver/375.39/lib64 or use a docker via docker run -it --rm -v nvidia_driver_375.39:/nvidia_driver debian to gain write permissions to the drivers, and patch them.
      • Copy /usr/lib/nvidia-375/libEGL.so.375.39 into the {nvidia_driver}/lib64/ directory
      • Make sure the symlinks for {nvidia_driver}/lib64/libEGL.so.1 and {nvidia_driver}/lib64/libEGL.so eventually link to the libEGL.so.375.39 file.
  • If you have the environment variable DISPLAY set, EGL will try and use the actual Display for offscreen OpenGL rendering instead of the headless route. This is difficult (but not impossible) because now you must run the command as the same user as the graphically logged in user.