Skip to content

Instantly share code, notes, and snippets.

View stuaxo's full-sized avatar
💭
 

Stuart Axon stuaxo

💭
 
View GitHub Profile
@kevcjones-archived
kevcjones-archived / howto-unlock-pdf
Last active June 20, 2022 02:19
Unlocking a PDF using ghostscript
required - install ghost script - e.g brew install ghostscript (takes a few minutes)
update this line as needed and run in terminal
-- New and updated thanks to comments --
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -SPDFPassword=THE_PASSWORD -sOutputFile=unencrypted.pdf -c .setpdfwrite -f 2017-06-13-11-55-56-188_14972345156188_XXXPT6345X_ITRV.pdf
-- Original --
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf
import sys
# PyQt4 imports
from PyQt4 import QtGui, QtCore, QtOpenGL
from PyQt4.QtOpenGL import QGLWidget
# PyOpenGL imports
import OpenGL.GL as gl
import OpenGL.arrays.vbo as glvbo
import types
*.py[oc]
@chris-ramon
chris-ramon / pycharm_installation.py
Last active June 4, 2016 10:32
installing pycharm on ubuntu.
sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
download pycharm
cd bin
chmod u+x
./pycharm.sh
@stuaxo
stuaxo / wb_to_dict.py
Last active August 26, 2022 01:20
Output an excel workbook as a python dict.Information about the formatting/colour of cells is lost - which is OK if the sheet is sensible. Individual rows are output horizontally.Types are converted to python types.This is not comprehensive + just enough for the sheet I happen to be working with today.
import datetime
import xlrd
from pprint import PrettyPrinter
def trim_nones(li):
""" remove trailing Nones from a list """
while li and li[-1] is None:
li.pop()
@yprez
yprez / fields.py
Last active February 19, 2023 12:08
Django rest framework - Base64 image field
import base64
from django.core.files.base import ContentFile
from rest_framework import serializers
class Base64ImageField(serializers.ImageField):
def from_native(self, data):
if isinstance(data, basestring) and data.startswith('data:image'):
# base64 encoded image - decode
@willpatera
willpatera / gsettings-desktop-schemas.rb
Last active June 24, 2020 12:22
GStreamer 1.0 + Python Tests
require 'formula'
class GsettingsDesktopSchemas < Formula
homepage 'http://ftp.gnome.org/pub/GNOME/sources/gsettings-desktop-schemas/'
url 'http://ftp.gnome.org/pub/GNOME/sources/gsettings-desktop-schemas/3.10/gsettings-desktop-schemas-3.10.1.tar.xz'
sha256 '452378c4960a145747ec69f8c6a874e5b7715454df3e2452d1ff1a0a82e76811'
depends_on 'xz' => :build
depends_on 'pkg-config' => :build
depends_on 'intltool' => :build
@XVilka
XVilka / TrueColour.md
Last active April 27, 2025 10:17
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@nddrylliog
nddrylliog / minimal-cairo.md
Last active May 29, 2024 16:26
Minimal cairo build - for the humanoid who already has everything and just needs vector graphics

You need both pixman and cairo, which you can find here: http://cairographics.org/releases/

Pixman configure:

../pixman-0.32.4/configure --prefix=/root/prefix --disable-libpng --disable-gtk

Cairo configure:

PKG_CONFIG_PATH=/root/prefix/lib/pkgconfig ../cairo-1.12.16/configure --prefix=/root/prefix --enable-xlib=no --enable-xcb=no --enable-xcb-shm=no --enable-win32=no --enable-quartz=no --enable-script=no --enable-ft=no --enable-fc=no --enable-ps=no --enable-pdf=no --enable-svg=no --enable-gobject=no --enable-trace=no --enable-interpreter=no --enable-png=no

@steinwaywhw
steinwaywhw / client.js
Last active April 20, 2022 11:47
A minimal term.js server/client demo. To be used with node.js
var client = {};
client.run = function (options) {
options = options || {};
var socket = io.connect(options.remote || "http://localhost:8080");
socket.on('connect', function() {
var term = new Terminal({