Skip to content

Instantly share code, notes, and snippets.

View thevtm's full-sized avatar

Vinícius Tabille Manjabosco thevtm

  • Rotterdam, Netherlands
View GitHub Profile
@thevtm
thevtm / berlin-appointments.js
Last active November 3, 2023 00:33
Berlin Appointments Alert
// Constants
const APPOINTMENTS_CALENDAR_URL = "/terminvereinbarung/termin/all/120686/"
const WAIT_DURATION_MS = 3 * 60 * 1000
const INITIAL_STATE = "INIT_STATE"
const SETTING_UP_STATE = "SETTING_UP_STATE"
const CHECKING_APPOINTMENTS_STATE = "CHECKING_APPOINTMENTS_STATE"
const WAITING_STATE = "WAITING_STATE"
const ALARM_STATE = "ALARM_STATE"
@thevtm
thevtm / dev-db
Created July 1, 2022 13:26
Database Development Utilities
#!/bin/python
# This is a simple script to help save and restore the database during development.
# Usage:
# - dev-db save users
# - dev-db restore users
import sys
import os
@thevtm
thevtm / gist:9bfef4056337ee4459ee9808db6dfb0b
Created December 11, 2020 14:59
Some usefull kubectl commands
#
# Some usefull kubectl commands
#
function kube-find-namespace() {
kubectl get namespaces | tail -n +2 | fzf -q "$1" | awk '/(.*)/ {print $1}'
}
function kube-app-pod() {
local namespace
namespace=$1
kubectl get pods --field-selector status.phase=Running -n "$namespace" | awk '/(.*)-app-(.*) / {print $1}' | head -n 1
@thevtm
thevtm / gist:16511e71c9b21e69088579aa8c421412
Created November 27, 2020 15:51
Alacritty terminal drop down (Quake style) using tdrop and sxhkd
# https://github.com/alacritty/alacritty
# https://github.com/dancor/wmctrl
# https://github.com/baskerville/sxhkd
# https://github.com/noctuid/tdrop
super + z
tdrop -n top --width 100% --height 30% --post-map-hook 'wmctrl -r "Alacritty - Drop Down - Top" -b add,above,sticky' alacritty --title 'Alacritty - Drop Down - Top'
super + shift + z
tdrop -n bottom -y 64% --width 100% --height 30% --post-map-hook 'wmctrl -r "Alacritty - Drop Down - Bottom" -b add,above,sticky' alacritty --title 'Alacritty - Drop Down - Bottom'
@thevtm
thevtm / flashcards.js
Last active March 5, 2023 19:00
Magic Flashcards
/***
* __ ______ ________________ ________ ___ _____ __ ___________ ____ ____ _____
* / |/ / | / ____/ _/ ____/ / ____/ / / | / ___// / / / ____/ | / __ \/ __ \/ ___/
* / /|_/ / /| |/ / __ / // / / /_ / / / /| | \__ \/ /_/ / / / /| | / /_/ / / / /\__ \
* / / / / ___ / /_/ // // /___ / __/ / /___/ ___ |___/ / __ / /___/ ___ |/ _, _/ /_/ /___/ /
* /_/ /_/_/ |_\____/___/\____/ /_/ /_____/_/ |_/____/_/ /_/\____/_/ |_/_/ |_/_____//____/
*
*/
(function() {
@thevtm
thevtm / benchmark-results.txt
Created November 30, 2017 07:08
zeit/ms parse regex benchmark
Benchmarking 6 regexes for 18 test cases
Benchmarking test case: "17697971165612536521198392175651265616253619638124 minutes"
original x 4,228,677 ops/sec ±1.47% (86 runs sampled)
prototype0 x 4,329,400 ops/sec ±2.68% (81 runs sampled)
prototype1 x 4,015,480 ops/sec ±2.31% (83 runs sampled)
prototype2 x 4,621,512 ops/sec ±1.20% (88 runs sampled)
prototype3 x 4,516,519 ops/sec ±0.75% (90 runs sampled)
***totype4 x 4,729,367 ops/sec ±1.01% (88 runs sampled)
@thevtm
thevtm / index.ts
Created October 17, 2017 15:29
Quick and dirty tricks for debugging Typescript
/*
* Orginial:
* Quick and dirty tricks for debugging Javascript by Chang Wang
* https://hackernoon.com/quick-and-dirty-tricks-for-debugging-javascript-d0e911c3afa
*
* Translated to Typescript by @TheVTM
*/
function print<T>(tag: string, param: T): T {
console.log(tag, param);
@thevtm
thevtm / main.js
Last active June 7, 2017 18:14
[Benchmark] ms vs Delagen/ms
'use strict'
/*
Modules
*/
var Benchmark = require('benchmark')
var ms = require('ms')
var msNew = require('ms-new')
@thevtm
thevtm / pagination.jade
Created September 15, 2016 19:10 — forked from backus/pagination.jade
Jade + Bootstrap Pagination Mixin
//- Pagination mixin
//- ----------------
//- numPages = # links to serve up
//- numButtons = # of "side" buttons that will be present.
//- 2 numButtons will result in | << | 1 | 2 |>3<| 4 | 5 | >> |
//- curr = current page
//- base = base url before num
//- start at page 1
//-
//- Example:
@thevtm
thevtm / workspace-switcher
Last active June 11, 2020 03:13
CLI workspace switcher for GNOME based on Based on Andy Balaam's workspace-switcher
#!/bin/bash
# Workspace switcher for GNOME
# Author: thevtm@github
#
# Based on Andy Balaam's workspace-switcher
# http://www.artificialworlds.net/blog/2011/03/04/switching-workspace-in-gnome-via-the-command-line/
#
# REQUIREMENTS:
# * wmctrl
#