Skip to content

Instantly share code, notes, and snippets.

View aambrozkiewicz's full-sized avatar

Aleksander Ambrozkiewicz aambrozkiewicz

View GitHub Profile
@aambrozkiewicz
aambrozkiewicz / randompassword.py
Last active September 5, 2023 12:44
Python utility script to generate password with given length and different alphabets
#!/usr/bin/env python
import functools
import secrets
import string
import click
alphabets = {
"digits": string.digits,
@aambrozkiewicz
aambrozkiewicz / .gitconfig
Last active September 2, 2020 13:16
git aliases that I use
[alias]
co = checkout
cob = checkout -b
st = status
ci = commit
chp = cherry-pick
p = pull
amend = checkout --amend
branch-name = !git branch --show-current
publish = !git push -u origin HEAD:$(git branch-name)
import collections
import functools
import requests
Invoice = collections.namedtuple('Invoice', [
'id', 'number', 'currency', 'paid_price', 'notes', 'kind', 'payment_method', 'recipient_signature',
'seller_signature', 'invoice_date', 'sale_date', 'status', 'payment_date', 'net_price', 'tax_price',
'gross_price', 'client_id', 'client_company_name', 'client_street', 'client_city', 'client_post_code',
import json
import functools
class CommandBus:
handlers = {}
def register(self, command_type, handler):
self.handlers[command_type] = handler
<?php
trait Observable
{
protected $subscribers = [];
public function on($name, $fn)
{
if (empty($this->subscribers[$name])) {
$this->subscribers[$name] = [];
@aambrozkiewicz
aambrozkiewicz / Transactional.php
Created January 15, 2017 14:40
Laravel Middleware with Database transaction
<?php
namespace App\Http\Middleware;
use Closure;
class Transactional
{
public function handle($request, Closure $next)
{
<?php
// php hax0r.php "witam" | pbcopy
$alphabet = [
'a' => '/-\\',
'b' => '|3',
'c' => '(',
'd' => '|)',
'e' => 'E',
@aambrozkiewicz
aambrozkiewicz / vue-js-shopping-cart.html
Created October 10, 2015 14:46
Vue.js shopping cart example
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>vue eatally</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css" media="screen">
<style type="text/css" media="screen">
body {
background-color: #f4f4f4;
<?php
interface StringSignatureStorage
{
function save(string $resourceId, array $keys);
}
interface StringStorageInterface
{
function fetch(string $resourceId);
@aambrozkiewicz
aambrozkiewicz / Snake.cpp
Created May 29, 2015 19:05
C++ Snake game
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <time.h>
#include "Snejk.h"
using namespace std;
CSnejk::CSnejk()