Skip to content

Instantly share code, notes, and snippets.

Avatar

Michal Proszek poxip

  • Poland
View GitHub Profile
@poxip
poxip / img2pdf.py
Created Sep 5, 2019
A simple way to convert any image to PDF with Pillow
View img2pdf.py
import sys
from PIL import Image
image = Image.open(sys.argv[1])
background = Image.new("RGBA", image.size, (255, 255, 255))
composite = Image.alpha_composite(background, image).convert("RGB")
composite.save(sys.argv[2], "PDF")
View booklets.md

Slajdy

javascript:!function(){var a=function(a){var b=function(){window.location.href="http://www.ekursy.prawojazdy.com.pl/kurs/"+$(".slides").data("course")},c={slide:function(){$.ajax({url:"/learningobjectpass",global:!1,type:"POST",dataType:"json",timeout:9e3,data:{scenarioId:$(".slides").data("scenario"),courseId:$(".slides").data("course"),currentLearningObject:$(".slides").attr("data-learningobject")},success:function(a){$(".change[data-direction='+']").trigger("click")}})},exercise:function(a){$.ajax({url:"/exercisepassed",global:!1,type:"POST",dataType:"json",timeout:9e3,data:{result:a.maxPoints,scenarioId:$(".slides").data("scenario"),courseId:$(".slides").data("course")}})}},d=0,e=parseInt($(".slideCounter").text().split("/")[1].trim()),f=c[a];if("undefined"==typeof f)return void console.error("Passing given type is not implemented");var g={};if(g.maxPoints=e,"slide"==a)var h=setInterval(function(){return d>=(e+1)?(clearInterval(h),void b()):(f(),void++d)},2e3);else f(g),b()};a("slide")}();
View netflix dns
#!/bin/bash
DNS_ORIG1="192.168.1.1"
DNS_ORIG2="fe80::f282:61ff:feb5:11cf%enp2s0f0"
DNS_NEW1="46.101.149.135"
DNS_NEW2="46.101.36.120"
if [ "$1" = "on" ]
then
@poxip
poxip / string-format.js
Last active Feb 25, 2016
Python-like string format in JavaScript
View string-format.js
/**
* Python-like string format function
* @param {String} str - Template string.
* @param {Object} data - Data to insert strings from.
* @returns {String}
*/
var format = function(str, data) {
var re = /{([^{}]+)}/g;
return str.replace(/{([^{}]+)}/g, function(match, val) {
View zomg.sh
#!/bin/bash
echo "ZOMG!"
View test.py
print("zomg!1!")
@poxip
poxip / file1.py
Last active Aug 29, 2015
gisht: Issue #2
View file1.py
#!/usr/bin/env python
print("file1.py")
@poxip
poxip / gisht_27
Last active Aug 29, 2015
gisht test
View gisht_27
#!/usr/bin/env python
print "lul"
@poxip
poxip / loading.py
Last active Aug 29, 2015
Loading a global module in Python3
View loading.py
import sys
from os import getcwd
from importlib import import_module
def import_global_module(name):
old_path = sys.path
try:
sys.path.remove(getcwd())
sys.path.remove('')
except ValueError:
You can’t perform that action at this time.