Skip to content

Instantly share code, notes, and snippets.

View tshirtman's full-sized avatar

Gabriel Pettier tshirtman

View GitHub Profile
@tshirtman
tshirtman / radial_shader.py
Last active March 19, 2025 11:43
Radial gradient shader demo
'''
radial gradient in glsl
'''
from kivy.app import App
from kivy.graphics import RenderContext, Rectangle
from kivy.uix.widget import Widget
from kivy.properties import ListProperty
from kivy.clock import Clock
from kivy.animation import Animation
from kivy.uix.gridlayout import GridLayout
@tshirtman
tshirtman / setup.sh
Last active April 8, 2018 02:54
setup dev environment on a new server
sudo apt-get update
sudo apt-get install vim fish byobu git-core
git clone git@github.com:tshirtman/git.git gitconfig
git clone git@github.com:tshirtman/.vim.git
git clone git@github.com:tshirtman/fishconfig.git
git clone git@github.com:tshirtman/.i3.git
git clone git@github.com:tshirtman/.mutt
git clone git@github.com:tshirtman/xmodmap.git
cd ~/gitconfig && ./init.sh
cd ~/.vim && ./init.sh
#!/usr/bin/env python
'''
Usage:
parse.py <path> <exportpath> <suffix> [<packagename>]
[--blacklist=<blacklist>] [--debug] [--cleanup]
parse.py --jar=<jarfile> <exportpath> [<packagename>]
--suffix=<suffix> [--blacklist=<blacklist>] [--debug] [--cleanup]
Options:
path is the path to look java classes into
from kivy.app import App
from kivy.uix.effectwidget import AdvancedEffectBase
from kivy.lang import Builder
from kivy.properties import NumericProperty
KV = '''
#:import Scanlines kivy.uix.effectwidget.ScanlinesEffect
#:import VerticalBlur kivy.uix.effectwidget.VerticalBlurEffect
#:import HorizontalBlur kivy.uix.effectwidget.HorizontalBlurEffect
#:import FXAA kivy.uix.effectwidget.FXAAEffect
@mitsuhiko
mitsuhiko / .gitconfig
Last active January 30, 2021 20:22
Adds the ultimate of all pull request commands to git
# Alternatively don't use slog but something else. I just like that more.
[aliases]
slog = log --pretty=format:"%C(auto,yellow)%h%C(auto)%d\\ %C(auto,reset)%s\\ \\ [%C(auto,blue)%cn%C(auto,reset),\\ %C(auto,cyan)%ar%C(auto,reset)]"
addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
git fetch origin pull/$1/head:pr/$1 && \
git fetch -f origin pull/$1/merge:PR_MERGE_HEAD && \
git rebase --onto $b PR_MERGE_HEAD^ pr/$1 && \
git branch -D PR_MERGE_HEAD && \
git checkout $b && echo && \
git diff --stat $b..pr/$1 && echo && \
@kived
kived / x11.py
Created June 27, 2014 18:44
x11 reparenting
from Xlib import display, error
import pygame.display
def get_current_window():
wminfo = pygame.display.get_wm_info()
return wminfo.get('window', None)
def swallow(wid, x, y):
handler = error.CatchError()
from kivy.base import runTouchApp
from kivy.lang import Builder
KV = '''
#:import Animation kivy.animation.Animation
FloatLayout:
BoxLayout:
id: box
orientation: 'vertical'
size_hint: .4, .4
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.properties import NumericProperty
KV = '''
#:import chain itertools.chain
#:import pi math.pi
#:import sin math.sin
#:import cos math.cos
@jed
jed / progress.js
Last active March 11, 2016 08:37
Using template strings as progress bars
"use strict"
function progress(strs, current, total) {
let str = `${strs[0]}${current}${strs[1]}${total}${strs[2]}`
let ratio = Math.min(Math.max(current / total, 0), 1)
let length = Math.floor(ratio * str.length)
let pattern = new RegExp(`^.{${length}}`)
return str.replace(pattern, "\x1b[4m$&\x1b[0m")
}
@kaanaksit
kaanaksit / androser.py
Last active August 19, 2021 01:55
Serial communication using pyjnius, Arduino Nano and USB-OTG
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = ('Kaan Akşit')
try:
import sys,time
from array import array
from jnius import autoclass
from jnius import cast