Skip to content

Instantly share code, notes, and snippets.

View artizirk's full-sized avatar

Arti Zirk artizirk

View GitHub Profile
@artizirk
artizirk / main.py
Created March 22, 2013 14:24
This is a Google Cloud Messaging demo server written in Python it needs a Web.py http://webpy.org/ and GCM https://github.com/geeknam/python-gcm libs to work
# Google Cloud Messaging demo server in python
import web # web.py lib
from gcm import GCM # https://github.com/geeknam/python-gcm
urls = (
'/gcm-demo', 'index',
'/gcm-demo/register', 'register',
'/gcm-demo/unregister', 'unregister'
)
@artizirk
artizirk / lego_nxt_sumo_bot.nxc
Last active December 15, 2015 15:48
code for our school lego nxt sumo bots
// sumobot with two sonic sensors
#define START_WAIT 5000 // ms
#define jooksu_aeg 500 // how much to back away from white line (ms)
#define mootor OUT_BC // motors
#define light_threshold 40 // light threshold
#define otsingu_kaugus 30 // distance for enemy
#define attack_speed 100 //
#define left_light_port IN_4 // vasak ees valgus
#define right_light_port IN_1 // parem ees valgus
@artizirk
artizirk / broker.py
Last active June 30, 2018 19:49
twisted message broadcast kind of a thing needs msgpack
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import print_function
from twisted.python import log
from twisted.internet.protocol import Factory
from twisted.protocols.basic import NetstringReceiver
from twisted.internet import reactor
from uuid import uuid4 as get_uuid
#!/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 / sendsms.sh
Last active December 3, 2022 20:41
send sms with ppp chat program
#!/bin/ash
#using: sendsms +375555555 "some text i want to send"
TELFNUMB=$1
SMSTEXT=$2
MODEM="/dev/ttyUSB1"
#reg to the network (maybe not needed)
gcom reg -d $MODEM
@artizirk
artizirk / test.sh
Created August 25, 2013 18:42
bash cgi script with bootstrap template
#!/bin/sh
echo "Content-type: text/html"
echo ""
cat << 'EOF'
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 101 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
@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 ##
################################################################################