Skip to content

Instantly share code, notes, and snippets.

@kgadek
kgadek / 0_reuse_code.js
Created November 21, 2016 15:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kgadek
kgadek / anaconda-ks.cfg
Last active May 28, 2016 16:11
Simple kickstart for VMs (insecure as hell)
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use network installation
url --url="http://mirror.onet.pl/pub/mirrors/centos/7/os/x86_64"
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
pyserver:
restart: "always"
build: ./src
ports:
- 8042:8042
links:
- dbserver:dbserver
env_file: .env
command: python /usr/src/app/server.py
@kgadek
kgadek / docker.service.diff
Created March 6, 2016 18:38
Fix for docker.service SystemD unit file /etc/systemd/system/docker.service
diff --git a/docker.service b/docker.service
index 3695d53..df0e3e9 100644
--- a/docker.service
+++ b/docker.service
@@ -1,5 +1,5 @@
[Service]
-ExecStart=/usr/bin/docker -d -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=azure
+ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=azure
MountFlags=slave
LimitNOFILE=1048576
@kgadek
kgadek / turbodynochecker.py
Created January 29, 2014 01:55
TurboDynoChecker - checking types in runtime via type annotations (PEP-3107)
from contextlib import contextmanager
from functools import wraps
from inspect import signature
from itertools import chain
class TypoDynoMismatch(Exception):
pass
@kgadek
kgadek / scrapemeagainimnotdeadyet.py
Created January 25, 2014 01:43
'Tallica: Seek and buy
#!/usr/bin/env python
# coding=utf-8
import os
from bs4 import BeautifulSoup
import requests
import time
import itertools
url = ("http://www.eventim.pl/Bilety-sonisphere-warszawa.html?affiliate=LNP&fun=evdetail"
@kgadek
kgadek / parser.py
Created January 22, 2014 22:05
Current state of mrwhite::parser.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import lxml
import lxml.html
from itertools import count
def clipboard_to_cells():
@kgadek
kgadek / mergesort.lua
Created January 22, 2014 01:24
Projekt Sauron: kod zadania map-reduce: merge-sort.
-- =====================================================================================================================
-- MOCK INTERFEJSU DOSTĘPNEGO NA APPCE
-- Dzięki temu można "ot tak" wrzucić kod w interpreter i będzie działać
-- ---------------------------------------------------------------------------------------------------------------------
local android = {}
function android.send(self, x)
print("ANDROID:SEND:", x)
end
function android.sleep(self, t)
print("ANDROID:SLEEP:", t)
@kgadek
kgadek / background_tasks_example.lua
Last active January 3, 2016 12:29
Projekt Sauron: interfejs i przykładowy kod zadania typu `background_tasks`.
-- ---------------------------------------------------------------------------------------------------------------------
-- MOCK INTERFEJSU DOSTĘPNEGO NA APPCE
-- ---------------------------------------------------------------------------------------------------------------------
os = require "os"
local android = {}
function android.send(self, x)
print("ANDROID:SEND:", x)
end
function android.sleep(self, t)
print("ANDROID:SLEEP:", t)
[ 20%] Building CXX object CMakeFiles/daemon.dir/src/sqlite.cpp.o
In file included from /home/konrad/lachesis/cpp/src/sqlite.cpp:1:
In file included from /home/konrad/lachesis/cpp/src/sqlite.hpp:7:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/memory:81:
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/../../../../include/c++/4.8.2/bits/unique_ptr.h:137:9: error: static_assert failed "constructed with null function pointer deleter"
{ static_assert(!is_pointer<deleter_type>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/konrad/lachesis/cpp/src/sqlite.cpp:32:20: note: in instantiation of member function 'std::unique_ptr<sqlite3, int (*)(sqlite3 *)>::unique_ptr' requested here
LachesisSQLite3db::LachesisSQLite3db(const char *db_path) throw(sqlExecException) {
^