Skip to content

Instantly share code, notes, and snippets.

View AstraLuma's full-sized avatar
🐍
snek snek snek snek

Jamie Bliss AstraLuma

🐍
snek snek snek snek
View GitHub Profile
#!/usr/bin/python3
import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import Gst, Gtk, GLib
import sys
import datetime
import textwrap
@AstraLuma
AstraLuma / texttest.py
Created November 29, 2015 23:38
IBus bug demonstration
#!/usr/bin/python3
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
class TextTestWindow(Gtk.Window):
def __init__(self):
super().__init__(title="Hello World")
@AstraLuma
AstraLuma / foo.py
Created March 9, 2016 17:00
Python Processing Idea
gitlog = program("git" "log").by_lines()
@gitlog.then
def authors(lines):
for line in lines:
yield extractauthor(line)
@authors.then
def domains(emails):
for e in emails:
@AstraLuma
AstraLuma / bugdemo.vala
Last active March 29, 2016 22:13
Vala double free bug
Bytes get_bytes() {
return new Bytes({0,1,2,3});
}
void double_free() {
string vtxshader = (string)get_bytes();
string frgshader = (string)get_bytes();
}
public static int main (string[] args) {
import usb1 # Using with_USBContext branch
import sys
REP1 = bytes([0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08])
REP2 = bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09])
HID_REPORT = 9
CONTROL_REQUEST_TYPE_OUT = usb1.RECIPIENT_INTERFACE | usb1.REQUEST_TYPE_CLASS
TO = 200 # Timeout
@AstraLuma
AstraLuma / README.md
Last active April 9, 2016 22:03
Some custom fortunes
From 471024d895e2b2679d2926d6f03528a78b90f8ba Mon Sep 17 00:00:00 2001
From: Jamie Bliss <astronouth7303@gmail.com>
Date: Thu, 21 Apr 2016 19:02:57 -0400
Subject: [PATCH] Add tip to array syntax error about fixed-width arrays.
---
vala/valaarraytype.vala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
import os.path
import sys
$PROJECT_DIRS = [os.path.expanduser('~/code'), os.path.expanduser('~/src')]
$SHELL_TYPE = 'best' # Work-around for #1561
$XONSH_SHOW_TRACEBACK = True
xontrib load prompt_ret_code pacman_tabcomplete vox_tabcomplete vox
xontrib load avox z
@AstraLuma
AstraLuma / bootshell
Last active October 26, 2019 17:14
Set up shellinabox and xonsh on ec2
#!/bin/sh -e
# EC2
#sudo yum install git zlib-devel autoconf automake libtool python35 python35-pip
# Scaleway - Ubuntu
sudo apt-get install git libpam0g-dev zlib1g-dev dh-autoreconf python3 python3-pip
# For some reason, the [ptk] doesn't work on Scaleway C1 with Ubuntu
sudo python3 -m pip install xonsh[ptk]
git clone https://github.com/shellinabox/shellinabox.git
import webview
import threading
from webview import OPEN_DIALOG, FOLDER_DIALOG, SAVE_DIALOG
import asyncio
# FIXME: Multiple window support
class WebviewThread(threading.Thread):
"""
Webview as a thread.