Skip to content

Instantly share code, notes, and snippets.

View tiagoad's full-sized avatar
🔨

Tiago tiagoad

🔨
View GitHub Profile
@tiagoad
tiagoad / 2018_f1.hs
Created January 23, 2018 18:06
Exames de Princípios de Programação - FCUL
import Test.QuickCheck
-- Grupo 1
-- a)
encontra :: (a -> Bool) -> [a] -> Maybe a
encontra f xs
| length matches == 0 = Nothing
| otherwise = Just (head matches)
where
@tiagoad
tiagoad / fenix_extract.md
Last active September 24, 2019 14:06
Converte o horário do Fénix para iCal (Google Calendar, etc)
  1. Abrir o horário no fénix e escolher o semestre

  2. Abrir a consola do browser (Ctrl+Shift+J / Cmd+Opt+J)

  3. Fazer paste do código abaixo e pressionar Enter

  4. Importar os ficheiros .ical para o calendário

    Google: https://calendar.google.com/calendar/r/settings/export

Testado no Chrome, no Fénix da FCUL.

@tiagoad
tiagoad / monitor-dir.py
Created December 9, 2018 17:42
Uses ReadDirectoryChangesW asynchronously (overlapped mode) to monitor a directory (and its' children) for changes.
import os
import time
import win32file
import win32con
import pywintypes
import winerror
WATCHED_DIR = "./mon"
@tiagoad
tiagoad / monitor-dir.py
Created December 9, 2018 17:46
Monitors a directory (and its' children) for changes on Windows, asynchronously (overlapped mode).
# Based partially on http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html (thanks!)
import os
import time
import win32file
import win32con
import pywintypes
import winerror
@tiagoad
tiagoad / userChrome.css
Created January 6, 2019 15:45
No tabs, No sidebar title. FF Quantum @ MacOS
/* Hide sidebar title for TST */
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
display: none;
}
/* From https://github.com/Timvde/UserChrome-Tweaks/blob/master/tabs/hide-tabs-macos.css */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@tiagoad
tiagoad / remote-devtools-render-poc.js
Created January 25, 2019 12:42
Remote browser/electron monitor through the devtools protocol
'use strict';
const puppeteer = require('puppeteer');
const CDP = require('chrome-remote-interface');
const fs = require('fs').promises;
function timeout(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@tiagoad
tiagoad / macos-pyodbc-freetds-mssql-django.md
Last active October 6, 2023 16:45
macOS Mojave + pyodbc + FreeTDS + SQL Server + Django 2.2

pyODBC + FreeTDS

  1. Run brew install unixodbc freetds
  2. Add section to /usr/local/etc/odbcinst.ini:
    [FreeTDS]
    Description     = FreeTDS unixODBC Driver
    Driver          = /usr/local/lib/libtdsodbc.0.so
    Setup           = /usr/local/lib/libtdsodbc.0.so
    UsageCount      = 1
@tiagoad
tiagoad / docker-compose.yml
Created May 21, 2020 21:28
Uber Cadence on Docker Swarm + mySQL
version: '3.5'
networks:
# for use by containers in other docker-compose files to connect to cadence
cadence:
# telegraf network (set up in another docker-compose file, you can replace with your own logging solution)
monitoring_monitoring:
external: true
@tiagoad
tiagoad / concelhos.csv
Created October 27, 2020 14:15
População por concelho (Portugal)
ABRANTES 35377
AGUIAR DA BEIRA 4740
ALANDROAL 5064
ALBERGARIA-A-VELHA 24128
ALBUFEIRA 41123
ALCANENA 12860
ALCOBAÇA 53641
ALCOCHETE 19505
ALCOUTIM 2244
ALCÁCER DO SAL 11712
@tiagoad
tiagoad / fix_wayland.sh
Created December 4, 2020 11:47
Fix "Firefox is already running" when opening links through other software on a wayland environment.
sudo su -c 'echo "export MOZ_DBUS_REMOTE=1" > /etc/profile.d/firefox_wayland_fixes.sh'