Skip to content

Instantly share code, notes, and snippets.

andrepcg / extracao_votacoes_parlamento.rb
Created Oct 17, 2020
Extrai resultado das votações na Assembleia da República
View extracao_votacoes_parlamento.rb
Proposal =, :votes_favor, :votes_against, :votes_abstention, :conclusion)
CONCLUSIONS = ['Aprovad', 'Rejeitad']
status = 'FINDING_START'
andrepcg /
Created Jun 12, 2019
Usar Pi-Hole em todos os devices da rede (excepto box IPTV da vodafone)
  1. Activar servidor DHCP no Pi-Hole
  2. Criar ficheiro /etc/dnsmasq.d/03-vodafone.conf
  3. Adicionar a seguinte configuração ao ficheiro
dhcp-host=<MAC ADDRESS DA TV BOX>,set:vodafone
dhcp-option=tag:vodafone,option:dns-server,<IP DO ROUTER DA VODAFONE>

Agora a Box continua a funcionar porque usa o DNS que o router da Vodafone lhe dá e todos os restantes dispositivos na rede utilizam o DNS anunciado pelo servidor DHCP que é o do Pi-Hole

View GreetingsHooks.js
import React, { useState, useContext, useEffect } from "react";
import { Card, Row, Input, Text } from "./components";
import ThemeContext from "./ThemeContext";
function Greeting(props) {
let [name, setName] = useState("Harry");
let [surname, setSurname] = useState("Potter");
let theme = useContext(ThemeContext);
useEffect(() => {
View GreetingsClass.js
import * as React from "react";
import { Card, Row, Input, Text } from "./components";
import ThemeContext from "./ThemeContext";
class Greeting extends React.Component {
constructor() {
this.state = {
name: "Harry",
sureName: "Potter",
View useCounter.js
import React, { useState } from "react";
const useCounter = (initialValue) => {
const [count, setCount] = useState(initialValue);
const increment = () => setCount(count + 1);
const decrement = () => setCount(count - 1);
return { count, increment, decrement };
function Counter() {
View react.memo.js
const Product = React.memo((props) => {
const { name, price } = props;
return (
<div className="product-info">

Keybase proof

I hereby claim:

  • I am andrepcg on github.
  • I am andrepcg ( on keybase.
  • I have a public key whose fingerprint is BA4A F148 669B D4D3 B8E0 B1EA 2B73 D827 47E0 DBE4

To claim this, I am signing this object:

andrepcg / shipitfile.js
Created Jan 20, 2018 — forked from jbraithwaite/shipitfile.js
Shipit deploy with Slack integration
View shipitfile.js
var pack = require('./package.json');
var request = require('request');
var name =;
module.exports = function (shipit) {
var deployTo = '/var/www/FOLDER_TO_DEPLOY_TO';
var deployToCurrent = deployTo + '/current';
var slackWebhookURL = 'SLACK_HOOK_URL';
View dlib and face_recognition on raspberry

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.


Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

# Your init script
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
# An example hack to log to the console when each text editor is saved.
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->