Skip to content

Instantly share code, notes, and snippets.

@andersonvom
andersonvom / vlsub.lua
Last active April 3, 2023 18:55
Lua script for VLC to download subtitles from OpenSubtitles.org
--[[
VLSub Extension for VLC media player 1.1 and 2.0
Copyright 2010 Guillaume Le Maout
Authors: Guillaume Le Maout
Contact: http://addons.videolan.org/messages/?action=newmessage&username=exebetche
Bug report: http://addons.videolan.org/content/show.php/?content=148752
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@andersonvom
andersonvom / email.rb
Created April 13, 2012 22:36
All 7-digit prime palindromes in the first 100.000 digits of PI
class Email
def self.arccot(x, unity)
xpow = unity / x
n = 1
sign = 1
sum = 0
loop do
term = xpow / n
break if term == 0
@andersonvom
andersonvom / estatisticas_album_figurinhas.py
Created September 11, 2022 14:50
Quantos pacotes sao necessarios para preencher um album de figurinhas? Simule aqui!
#!/usr/bin/env python
import json
import random
import sys
import statistics
def gerar_pacote(total, por_pacote):
return [ random.randint(1, total) for i in range(por_pacote) ]
@andersonvom
andersonvom / xcquiet.sh
Last active January 24, 2022 23:50
xcquiet hides a lot of the verbosity of xcodebuild without accidentally hiding useful, unexpected log entries.
#!/bin/bash
# Do you find `xcodebuild` too verbose but don't want `xcpretty`
# to swallow ALL the output, including sometimes useful output,
# all so that you can have more sane logs for your iOS builds?
# You also think using `-quiet` hides way too much info as well?
#
# This little snippet hides a lot of the verbosity of xcodebuild
# without accidentally hiding unexpected log lines.
#
# Usage: xcodebuild ... | xcquiet.sh
@andersonvom
andersonvom / set.vs.inclusion.test.py
Created November 25, 2015 15:30
This is why you should use sets and not roll out your own implementation of set operations in python (or any language)
import random
import time
stop = 100000
difference_count = 10000
all_keys = range(stop)
random.shuffle(all_keys)
diff_keys = [random.randint(0, stop) for i in range(difference_count)]
s = time.time()
#!/bin/bash
# This script will submit all pending commits to gerrit and will automatically
# add reviewers to the associated change. Reviewers can be added by simply
# listing them after greview. You can either enter their full email addresses
# or just partially enter a unique combination of letters that will be
# fuzy-matched to either the email or the name of the commiters.
#
# Usage: greview <reviewer-1> <reviewer-2> ...
@andersonvom
andersonvom / clone_org
Last active January 25, 2017 16:48
This script clones all public repos from a given github organization in parallel
#!/bin/bash
if [ "$1" == "" ]; then
app=$(basename ${0})
echo "Usage: $app <organization_name> [<curl opts>]"
echo " e.g. $app twitter # clone all public repos from <twitter>"
echo " e.g. $app syncthing -u andersonvom # clone all public and private repos from <syncthing> that <andersonvom> has access to"
exit 1
fi
@andersonvom
andersonvom / boxstarter-windev.ps1
Last active November 29, 2016 02:43
BoxStarter .NET development box
# Enable Developer Mode & Install Bash
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
# Microsoft-Windows-Subsystem-Linux doesn't seem to be working =(
# Enable-WindowsOptionalFeature -Online -FeatureName "Microsoft-Windows-Subsystem-Linux" -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName "TelnetClient" -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName "NetFx3" -All -NoRestart
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Set-TaskbarOptions -Size Small -Combine Full

Keybase proof

I hereby claim:

  • I am andersonvom on github.
  • I am andersonvom (https://keybase.io/andersonvom) on keybase.
  • I have a public key ASAqerC--v3FKqCzQSi19OMHm2Ova29u04A9ClEfLf6bjgo

To claim this, I am signing this object:

@andersonvom
andersonvom / eleicoes-2014.py
Last active April 11, 2016 02:37
Acompanhe os resultados das eleições para presidente de 2014 sem sair do terminal!
import logging
import os
import re
import requests
import subprocess
import time
loggers = {}