Skip to content

Instantly share code, notes, and snippets.

View tcurvelo's full-sized avatar
🏠

Thiago Curvelo tcurvelo

🏠
View GitHub Profile
@tcurvelo
tcurvelo / jupyter_splash.sh
Created September 19, 2020 21:30
Run container with Splash, Jupyter and GUI support
#!/bin/bash
xhost +local:docker
docker run \
-e DISPLAY=unix$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $XAUTHORITY:$XAUTHORITY \
-v $(pwd)/notebooks:/notebooks \
-e XAUTHORITY=$XAUTHORITY \
-p 8888:8888 \
# -*- coding: utf-8 -*-
from datetime import date
from urllib.parse import urlencode
import scrapy
class TjpbSpider(scrapy.Spider):
name = "tjpb"
allowed_domains = ["juris.tjpb.jus.br"]
@tcurvelo
tcurvelo / takeout.js
Created April 18, 2018 00:46
WIP: Automating Google Takeout Download
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
await page.goto('https://takeout.google.com/');
const input = await page.evaluate(() => {
const next = document.querySelector('#identifierNext');
@tcurvelo
tcurvelo / xmlsplit.py
Created September 3, 2017 01:19
Cli utility for spliting a big XML file into smaller parts.
#!/usr/bin/env python3
"""
Cli utility for spliting a big XML file into smaller parts.
The breakpoint will be the element of depth 1 (below root) that does not
fit in the specified maximum size. Each part created will have the same
root element.
Usage:
$ xmsplit size prefix [filename]
@tcurvelo
tcurvelo / all_crontabs.sh
Created July 18, 2017 19:00
Get all contrabs jobs
for user in $(getent passwd | cut -f1 -d: ); do
crontab -u $user -l && echo $user && printf '=%.0s' {1..100} && echo ;
done 2> /dev/null
@tcurvelo
tcurvelo / homologacao.js
Last active February 19, 2017 04:55
Inclui faixa de 'versão de homologacao'
document.addEventListener("DOMContentLoaded", function(event) {
const faixa = document.createElement('div');
const estilo = document.createElement('style');
faixa.id='faixa-homologacao';
faixa.textContent = 'Versão de Homologação';
estilo.textContent = `
#${faixa.id} {
margin: 0;
@tcurvelo
tcurvelo / numbers_only.js
Last active July 21, 2016 13:30
Restricting keys allowed to an input
document.getElementById('numbersonly').addEventListener(
'keypress',
function() {
var allowed_keys = {
48: true, // 0
49: true, // 1
50: true, // 2
51: true, // 3
52: true, // 4
53: true, // 5
@tcurvelo
tcurvelo / belman_ford.c
Created May 11, 2014 06:24
Bellman-Ford's shortest path
#include <stdio.h>
#define INFINITO 32766
#define TRUE 1
#define FALSE 0
#define NN 150
typedef unsigned char BOOL;
@tcurvelo
tcurvelo / dijkstra.c
Last active June 25, 2016 04:38
Dijkstra's shortest path
#include <stdio.h>
#define INFINITO 32766
#define TRUE 1
#define FALSE 0
#define NN 150
typedef unsigned char BOOL;
/* Dijkstra */
@tcurvelo
tcurvelo / meg.c
Created May 11, 2014 06:19
Sistemas Lineares: Metodo de Eliminacao de Gauss
/***************************************************
Universidade Federal da Paraiba
Centro de Ciencias Exatas e da Natureza
Disciplina: Calculo Numerico
Thiago Curvelo dos Anjos - Matr.: 010211026
****************************************************
Sistemas Lineares: Metodo de Eliminacao de Gauss
***************************************************/
#include <stdio.h>