Skip to content

Instantly share code, notes, and snippets.

Alessandro Balzano alfateam123

Block or report user

Report or block alfateam123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alfateam123
alfateam123 / lifejournal.sh
Created Apr 30, 2019
lifejournal script - daily log from the command line (vim + git)
View lifejournal.sh
#!/usr/bin/env bash
cd $HOME/projects/lifejournal
today=$(date +%Y%m%d-%H%M%S)
new_fname="${today}.txt"
vim "${new_fname}"
if [ -e $new_fname ]; then
@alfateam123
alfateam123 / data.dzn
Created Jan 25, 2019
Emptying cashless keys with MiniZinc
View data.dzn
START_AMOUNT = 260; % 2.60 euro
BEVERAGES = { coffee, tea, ginseng, chocolate };
COST = [ 25, 40, 35, 30 ];
@alfateam123
alfateam123 / enzyme-react-intl.d.ts
Last active Jul 18, 2018
enzyme-react-intl.d.ts
View enzyme-react-intl.d.ts
declare module "enzyme-react-intl" {
import {Component, ReactElement} from "react";
import {MountRendererProps, ReactWrapper} from "enzyme";
export function loadTranslation(localeFilePath: string): { [key: string]: string };
export function loadTranslationObject(translations: { [key: string]: string }): { [key: string]: string };
export function shallowWithIntl<C extends Component, P = Component["props"], S = Component["state"]>(
node: ReactElement<P>): ReactWrapper<P, S, C>;
View nice_loop.rb
live_loop :arp do
#stop
play (scale :e3, :minor_pentatonic).tick,
release: 0.20,
amp: 0.25
sleep 0.125
end
live_loop :pippo do
#stop
@alfateam123
alfateam123 / cargo.txt
Last active Aug 17, 2017
problem with early returns in rust - `if` without `else` that returns a value
View cargo.txt
Compiling rust_problem v0.1.0 (file:///home/winter/projects/rust_problem)
error[E0308]: mismatched types
--> src/main.rs:3:3
|
3 | None
| ^^^^ expected (), found enum `std::option::Option`
|
= note: expected type `()`
found type `std::option::Option<_>`
@alfateam123
alfateam123 / mergepass.py
Created May 27, 2017
Script to merge conflicted Keepass Classic .xml exports in a single .xml file
View mergepass.py
from xml.dom import minidom
from collections import namedtuple
import os
PwEntry = namedtuple("PwEntry", [
"group",
"groupTree",
"title",
"username",
"url",
@alfateam123
alfateam123 / quotes.md
Last active Sep 6, 2019
Random funny quotes I find while reading blogposts or source code
View quotes.md

This is a collection of some funny quotes

Unix: just enough potholes and bear traps to keep an entire valley going.

from Rachel By The Bay

Hacking around with private methods like this is juggling footguns

comment found inside app-route source code (2016?). By the way, the code still works as expected.

Tricky Akka mocks make Jenkins kaboom

Example sentence for the fantasque-sans font

@alfateam123
alfateam123 / tag_polygons.py
Created Jan 10, 2017
script per il tagging di <polygon> in un .svg
View tag_polygons.py
from xml.dom import minidom
SRC_FILE = "public/images/macchina.svg"
DST_FILE = "public/images/fuffa.svg"
with open(SRC_FILE) as source:
doc = minidom.parse(source)
svg_elem = doc.childNodes[0]
@alfateam123
alfateam123 / devulcanize.py
Created Dec 1, 2016
simple script to extract all <dom-module> Polymer component definitions from a vulcanized file.
View devulcanize.py
# usage: python devulcanize.py
# parses a file called `vulcanized.html` and splits it
# into several files, separated in different folders
# according to the `assetpath` attribute.
# it does not create the folders, though: look for IOErrors and OSErrors
# inside the traceback.
# requires beautifulsoup4
from bs4 import BeautifulSoup
View article.md

TIS-100's "Unconditional": solve SIGNAL COMPARATOR without conditional jumps

Screenshot

I did it, somehow. I'm writing these notes to save somewhere how that thing work.

Why?

I looked at the achievements, and it looked cool.

You can’t perform that action at this time.