Skip to content

Instantly share code, notes, and snippets.

import collections
import datetime
import hashlib
import random
import string
import sys
from contextlib import suppress
random.seed(0)
@tilacog
tilacog / Makefile
Created November 2, 2017 00:25
Download NFe XML files from Google
numsites=3
all: invoices
search-results.json:
googler --count ${numsites} --exact --noprompt 'intitle:”index of” nfe xml' --json > $@
sites.txt: search-results.json
< search-results.json jq ".[]|.url" | sed 's/"//g' > $@
invoices: sites.txt
@tilacog
tilacog / esocial-xsd-to-csv.py
Last active November 10, 2017 16:11
converter xsds do esocial para csv
import os
import csv
import sys
from glob import glob
from xml.etree import ElementTree as ET
xsd_dir_path = 'PUT BASE DIRECTORY HERE :)'
no_duplicate_tables = '--no-duplicates' in sys.argv
done_tables = set()
@tilacog
tilacog / unzip-recurse.py
Created January 22, 2018 21:00 — forked from pmuellr/unzip-recurse.py
tool to recursively unzip .zip and .jar files
#!/usr/bin/env python
import os
import sys
import subprocess
import zipfile
#-----------------------------------------------------------------------------
def main():
fileNames = sys.argv[1:]
@tilacog
tilacog / pretty_sped_specification.py
Created April 17, 2018 17:52
pretty print specification files
import sys
from xml.etree.ElementTree import iterparse
from types import SimpleNamespace
def show(text, depth, spacer=' '):
print(spacer * depth + text)
def main(spec_file_path):
# This function will be called before each test case.
setup () {
# This block will run only for the first test in this file.
# Usefull for setting up resources that should last for all tests.
if [[ "$BATS_TEST_NUMBER" -eq 1 ]]; then
:
fi
:
}
@tilacog
tilacog / multiproducer-consumer.py
Last active April 6, 2020 13:35 — forked from RasmusFonseca/multiproducer-consumer.py
Python multiple producer / single consumer example
from multiprocessing import Lock, Process, Queue
print_lock = Lock()
def square_producer(inputqueue, resultqueue):
"""A producer that pops numbers off the inputqueue, squares them and puts the
result on resultqueue
"""
while True:
@tilacog
tilacog / pomodoro.sh
Last active November 2, 2020 19:21 — forked from gabriel-bezerra/pomodoro.sh
Shell script Pomodoro timer for ubuntu unity
#!/bin/env bash
#
# Pomodoro script.
#
# Displays a notification after X minutes.
#
# Depends on libnotify-bin
main() {
minutes=$1
@tilacog
tilacog / bump.clj
Last active December 2, 2020 04:01
bump.clj
#!/usr/bin/env bb
;; -*- mode: clojure -*-
(defn first-rest [col]
[(first col) (rest col)])
(defn split-path [file]
(let [file (io/file file)]
[(.getParent file) (.getName file)]))
[package]
edition = "2021"
name = "block-search-bin"
version = "0.1.0"
[dependencies]
anyhow = "*"
chrono = "*"
hex = "*"
serde_json = "*"