Skip to content

Instantly share code, notes, and snippets.

View lukaszb's full-sized avatar

Lukasz Balcerzak lukaszb

  • Warsaw
View GitHub Profile
@lukaszb
lukaszb / dicts.py
Last active June 18, 2018 14:26
pytest dicts comparison
"""
Run it with:
pytest dicts.py --tb=short
"""
import dictdiffer
import json
import pytest
@pytest.fixture
@lukaszb
lukaszb / vue-conf-2017-notes.md
Last active June 23, 2017 15:01
Vue Conference 2017 Notes

State of vue 2017

Evan gave some quick overview of vue history and how the project and community grew to one of the biggest js framework around.

Just finished / coming soon

@lukaszb
lukaszb / http.js
Last active May 15, 2019 02:49
es6 http client using fetch
import 'whatwg-fetch'
import Auth from './Auth';
import Url from 'url-parse';
const API_URL = process.env.API_URL
const http = {
get: get,
getAuthed: getAuthed,
@lukaszb
lukaszb / Hasher.java
Last active January 19, 2024 01:35
Java implementation of Django PasswordHasher
/* Example implementation of password hasher similar to Django's PasswordHasher
* Requires Java8 (but should be easy to port to older JREs)
* Currently it would work only for pbkdf2_sha256 algorithm
*
* Django code: https://github.com/django/django/blob/1.6.5/django/contrib/auth/hashers.py#L221
*/
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;

Setup Mac OS X Mountain Lion

I just replaced the hard drive of my mbp and decided to do a clean install of Mountain Lion (10.8.5) since I was still using Snow Leopard (10.6.8).

I kinda regret for not using Boxen to automate the process, but TBH I have this laptop for almost 3yrs and this is the first time I needed to reinstall everything, maybe the next time...

@lukaszb
lukaszb / gist:7980135
Created December 16, 2013 00:05
sqlite3 dump from db created with https://gist.github.com/lukaszb/7980109
This file has been truncated, but you can view the full file.
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE "package" (
"id" integer NOT NULL PRIMARY KEY,
"name" varchar(1024) NOT NULL UNIQUE,
"versions" text NOT NULL
);
INSERT INTO "package" VALUES(1,'0x10c-asm','["0.0.2"]');
INSERT INTO "package" VALUES(2,'1009558_nester','["1.0.1"]');
INSERT INTO "package" VALUES(3,'18-e','["final"]');
@lukaszb
lukaszb / pypistats.py
Created December 16, 2013 00:02
Small app for creating pypi stats (mainly, extracting Python version classifier). It's generally hacky and smelly but makes the job done. Also, I needed some indexes so am using Django for db.
#!/usr/bin/env python
# encoding: utf-8
import os
import sys
from django.conf import settings
abspath = lambda *p: os.path.abspath(os.path.join(*p))
ROOT_DIR = abspath(os.path.dirname(__file__))
APP = os.path.splitext(os.path.basename(__file__))[0]
@lukaszb
lukaszb / ensure-calls.py
Created October 16, 2013 11:06
How to ensure method calls order
class Handler:
def handle(self):
self.process()
self.postprocess()
def process(self):
pass
@lukaszb
lukaszb / linecat.py
Created May 9, 2013 19:35
Use it with
#!/usr/bin/env python
"""
Use it as::
ls -l | python linecat.py
or::
python linecat.py < file.txt
@lukaszb
lukaszb / notify.py
Created February 21, 2013 01:23
Simple Python script to send notification to the OSX Notifications Center (requires OS X 10.8+). Tested with pyobjc 2.5.1
#!/usr/bin/env python
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
from optparse import OptionParser
def main():
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE')