Skip to content

Instantly share code, notes, and snippets.

View bancek's full-sized avatar

Luka Zakrajšek bancek

  • Koofr
  • Ljubljana, Slovenia
View GitHub Profile
# pip install pysimplesoap
import os
import random
from BaseHTTPServer import HTTPServer
from pysimplesoap.server import SoapDispatcher, SOAPHandler
def GetQuantityInStock(ProductName):
return random.randint(0, 500)
@bancek
bancek / jpgs_to_pdf.sh
Created February 11, 2013 20:17
JPGs to PDF
convert -resize 2048x2896 -density 300 -page A4 $(ls -rt *.jpg | sort) -compress jpeg -quality 90 -extent 2048x2896 output.pdf
@bancek
bancek / echofix.sh
Created February 13, 2013 23:47
Fix terminal's echo
stty -raw echo
@bancek
bancek / json-format.sh
Created February 20, 2013 11:24
Shell JSON format
alias j='python -mjson.tool'
@bancek
bancek / django_url_fix
Created March 9, 2013 13:48
Django fix url template tags
Replace: \{% url ([^']\w+)
With: {% url '\1'
@bancek
bancek / smtpserver.sh
Created March 9, 2013 14:26
Fake SMTP server
sudo python -m smtpd -n -c DebuggingServer localhost:25
@bancek
bancek / ucilnica.py
Created March 29, 2013 08:48
Login for FRI ucilnica
# pip install requests
import re
import requests
UCILNICA_LOGIN_URL = 'https://ucilnica.fri.uni-lj.si/login/index.php'
UCILNICA_LOGGEDIN_URL = 'https://ucilnica.fri.uni-lj.si/'
def ucilnica_login(username, password):
"""Check login for FRI ucilnica
@bancek
bancek / rand.sh
Created April 2, 2013 15:41
Bash random
rseed=42
random=0
function generate_random {
if [[ $rseed == 0 ]]; then
rseed=123459876
fi
h=$(($rseed / 127773))
l=$(($rseed % 127773))
@bancek
bancek / scala.coffee
Created June 5, 2013 16:28
Calling Scala from Node.js
# Install node-java
# npm install java
# Create file Foo.scala
# case class Foo(bar: String, baz: String)
# and compile it
# scalac Foo.scala
java = require 'java'
@bancek
bancek / queue.coffee
Created July 3, 2013 01:07
AngularJS job queue
angular.module('Queue')
.factory('Queue', ($q) ->
class Queue
constructor: ->
@queue = []
@processing = no
enqueue: (func) =>
defer = $q.defer()