Skip to content

Instantly share code, notes, and snippets.

@denilsonsa
denilsonsa / migrate_bitbucket_mercurial_to_github.py
Last active July 1, 2020 19:45
Migrate Bitbucket mercurial repositories to GitHub
#!/usr/bin/env python3
#
# migrate_bitbucket_mercurial_to_github.py
#
# This is a single-use script to export all my Bitbucket.org mercurial
# repositories into my GitHub. Why? Because:
# https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket
#
# This script has my username hard-coded in the code.
#
@denilsonsa
denilsonsa / humblebundle_downloader.js
Last active May 22, 2020 22:32
Humble Bundle downloader
// This thing can be copy-pasted into the browser devtools JavaScript console, on the following page:
// https://www.humblebundle.com/home/library
// It was written to automatically download all torrent files from my Humble Bundle library.
//
// 1. Open the page.
// 2. Filter by ebooks.
// 3. Select BitTorrent instead of direct download.
// 4. Click on the first product to start downloading.
// 5. Run the code below.
@denilsonsa
denilsonsa / index.html
Last active September 10, 2021 12:00
getElementsByClassName vs getElementById vs querySelector (http://jsbench.github.io/#6fdcc5a726220a85eb7c6a00e955d532) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>getElementsByClassName vs getElementById vs querySelector</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@denilsonsa
denilsonsa / Demo.md
Last active May 1, 2024 11:50
Markdown rendering of code block inside nested list

Markdown rendering of code block inside nested list

Demonstration of a bug in GitLab's Markdown rendering.

I have a nested list, and a code block in the middle of the list.

  1. Numbered list
    • Nested list

Code block inside the nested list

@denilsonsa
denilsonsa / README.md
Last active May 1, 2024 11:37
Train Conductor World - tiled map

Train Conductor World - tiled map

[Train Conductor World][tcw] is mobile game (for [iOS][ios] and [Android][and]) by [The Voxel Agents][tva]. The game has several cities on a world map (currently, only European cities).

This project (i.e. this GitHub Gist) is an effort to replicate the game world map outside the game. For that, I've used [Tiled Map Editor][tiled] to rebuild the map, and [Gimp][gimp] to create the graphics. This map can be used in the future to help planning in-game routes.

The graphics are based on [in-game screenshots][ss].

@denilsonsa
denilsonsa / path_normalize_by_string_manipulation.pl
Last active February 27, 2024 07:59
How to normalize a path in Perl? (without checking the filesystem)
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
# https://stackoverflow.com/questions/45631519/how-to-normalize-a-path-in-perl-without-checking-the-filesystem
my %solutions = (
denilson_answer => sub {
@denilsonsa
denilsonsa / 9verdades1mentira.ipynb
Last active May 1, 2024 11:52
9 verdades e 1 mentira, testadas usando pythonlogica
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@denilsonsa
denilsonsa / moneylog_convert.py
Created June 14, 2016 10:36
moneylog_convert.py que usei até final de 2014
#!/usr/bin/env python2
# -*- coding: utf8 -*-
from __future__ import unicode_literals
import sys
from datetime import date, timedelta
import re
@denilsonsa
denilsonsa / README.md
Last active May 1, 2024 11:41
Embed VTT subtitles into HTML

Embed VTT subtitles into HTML

Objective

I have a video file on my local disk. I also have some subtitles (in HTML5's [WebVTT][] format).

I want to create an HTML file to play that video with subtitles, all from the local filesystem.

Problem

@denilsonsa
denilsonsa / README.md
Last active March 20, 2016 06:21
Videosub hack to play embedded .SRT subtitles in HTML5 video