Skip to content

Instantly share code, notes, and snippets.

Avatar

Paweł Szczur orian

View GitHub Profile
View gen.py
# pip install pyqrcode
# pip install pypng
import pyqrcode
for i in range(1000,1500):
number = pyqrcode.create(i)
number.png('dest/{}.png'.format(destdir,i))
@orian
orian / rotate_and_crop.go
Last active Apr 7, 2016
Demonstrate how to rotate and then crop image.
View rotate_and_crop.go
// http://dev.pawelsz.eu/2016/04/go-imagick-image-croping-after-rotation.html
//
package main
import (
"gopkg.in/gographics/imagick.v2/imagick"
"log"
"math"
)
@orian
orian / docker-compose.yaml
Created Feb 11, 2016
docker-compose file with user defined network, data container, rabbitmq, mysql
View docker-compose.yaml
version: '2'
services:
rmq:
container_name: rm-rabbitmq
image: rabbitmq:3.6
networks:
- rmnet
data:
@orian
orian / calc_size.go
Created Feb 8, 2016
Calculate size of resized image
View calc_size.go
package main
import (
"fmt"
"math"
)
func CalcNewSize(w, h uint, maxW, maxH int32) (uint, uint) {
haveF := float64(w) / float64(h)
wantF := float64(maxW) / float64(maxH)
@orian
orian / name_gen.go
Last active Aug 29, 2015
pattern name generator
View name_gen.go
package main
import (
"fmt"
"path"
)
type StringGenerator interface {
Next() bool
Get() string
@orian
orian / go_install.sh
Last active Aug 29, 2015
Go install script
View go_install.sh
#!/bin/bash
# 1. Save file as go_install.sh
# 2. chmod +x go_install.sh
# 3. ./go_install.sh
# 4. Profit.
# Get Go package
PKGNAME=go1.3.3.linux-amd64.tar.gz
rm -f $PKGNAME
wget https://storage.googleapis.com/golang/$PKGNAME
View projekt_6.go
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
for a != b {
if a > b {
a = a - b
} else {
View projekt_6.go
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
for {
if a > b {
a = a - b
} else if a < b {
View projekt_6.go
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
var w int
for w == 0 {
if a > b {
View projekt_6.go
// Projekt6.1.1
package main
import "fmt"
func NWD(A1, B1 int) int {
var W int
for W == 0 {