Skip to content

Instantly share code, notes, and snippets.

View artizirk's full-sized avatar

Arti Zirk artizirk

View GitHub Profile
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#LICENSE: WTFPL
#DEPENDS: on this cool font from http://asdasd.rpg.fi/~svo/glasstty/
#TODO: port to Python3
from time import sleep
from sys import stdout
@artizirk
artizirk / fish.py
Last active December 17, 2015 18:49
not interesting
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import print_function
num = raw_input("enter positive even number: ")
num = int(num)
result = 2
@artizirk
artizirk / rpi_lcd.py
Created June 25, 2013 00:14
raspberry pi char lcd driver code code in action: http://www.youtube.com/watch?v=zVc76BmyIsM
#!/usr/bin/python
import RPi.GPIO as GPIO
from time import sleep
class HD44780:
def __init__(self, pin_rs=7, pin_e=8, pins_db=[25, 24, 23, 18]):
self.pin_rs=pin_rs
@artizirk
artizirk / gist:6264890
Created August 19, 2013 00:39
Software 3D rendering a cube with Python and SDL2. I ported some javascript code from there: http://www.cores2.com/3D_Tutorial/
#!/usr/bin/python2
from math import sin, cos
from sdl2 import SDL_QUIT, SDL_MOUSEMOTION, SDL_MOUSEWHEEL
import sdl2.ext as sdl2ext
from sys import stdout
import time
BLACK = sdl2ext.Color(0, 0, 0)
WHITE = sdl2ext.Color(255, 255, 255)
@artizirk
artizirk / auto_upload.py
Created August 31, 2013 22:35
Automaticly upload screenshots to the internet
#!/usr/bin/python2
################################################################################
## Automatic screenshot uploader ##
## ##
## WARNING, CONTAINS BAD CODE ##
## AND SECURITY HOLES! ##
## ##
## AUTHOR: Arti Zirk <arti.zirk@gmail.com> ##
## LICENSE: WTFPL ##
################################################################################
@artizirk
artizirk / index.html
Last active December 22, 2015 12:49 — forked from darwin/index.html
My awesome comics
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">I'm awesome</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|2,90|16,87">
@artizirk
artizirk / ping_test_script.sh
Created December 8, 2013 22:17
monitors if host is up or down
#!/bin/bash
echo "[`date`][Start] Host alive tester"
host_ip_addr="192.168.10.100"
alive_history=()
alive_history_size=5
while true; do
#ping -nqc1 $host_ip_addr &> /dev/null #ping not good because cant set timeout time
#!/usr/bin/env python3
#######################
#
# Auto scroll while holding down mouse side buttons
#
#
from pymouse import PyMouse
from pymouse import PyMouseEvent
import threading
@artizirk
artizirk / objs.js
Created April 22, 2016 22:16
javascript prototype objects test
function Obj() {
console.log("obj init");
this.bs();
}
Obj.prototype.bs = function() {
console.log("this is bs");
};
var obj = new Obj();
@artizirk
artizirk / kbm_sleep.sh
Created August 4, 2016 23:37
Puts my keyboard and mouse to sleep, ie turns off the leds when the screen goes to sleep
#!/bin/bash
old_dpms=""
while true; do
dpms=$(xset -q|grep Monitor|awk '{print $3;}')
if [ "$dpms" != "$old_dpms" ]; then
old_dpms=$dpms
if [ "$dpms" == "Off" ]; then
echo "Puting keyboard and mouse to sleep"
echo auto | sudo tee /sys/bus/usb/devices/3-13/power/control
echo auto | sudo tee /sys/bus/usb/devices/3-14/power/control