Skip to content

Instantly share code, notes, and snippets.

View pedro2555's full-sized avatar
😷
Out sick

Pedro Rodrigues pedro2555

😷
Out sick
View GitHub Profile
@pedro2555
pedro2555 / nginx-mpeg-dash-caching.conf
Created March 18, 2021 12:53
This is not a production config, this is from out lab environment. NGINX configuration to use as an MPEG-DASH edge caching system for use with Wowza Streaming Engine Live Streams. Ideally the caching zone should be entirely in ramfs or similar diskless filesystems.
user nginx;
worker_processes auto;
pid /var/run/nginx.pid;
worker_rlimit_nofile 1048576;
events {
worker_connections 1048576;
multi_accept on;
use epoll;
}
apt update
apt upgrade
apt dist-upgrade
ubuntu-drivers autoinstall
apt install -y software-properties-common
add-apt-repository ppa:linrunner/tlp
add-apt-repository ppa:ubuntuhandbook1/apps
add-apt-repository ppa:mpstark/elementary-tweaks-daily
apt update
apt install -y ubuntu-restricted-extras libavcodec-extra libdvd-pkg vlc unace rar unrar p7zip-rar p7zip sharutils uudeview mpack arj cabextract lzip lunzip tlp tlp-rdw laptop-mode-tools elementary-tweaks
@pedro2555
pedro2555 / db_fos.sql
Last active May 11, 2019 14:35
tapvirtual database structure dump
-- MySQL dump 10.13 Distrib 5.6.35, for debian-linux-gnu (x86_64)
--
-- Host: flytapv.com Database: db_fos
-- ------------------------------------------------------
-- Server version 4.1.21-standard
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@pedro2555
pedro2555 / setup.sh
Created April 26, 2019 16:39 — forked from jjvillavicencio/setup.sh
Install Android SDK on Windows Bash (WSL)
cd /home/<user>/
sudo apt-get install unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d Android
rm sdk-tools-linux-4333796.zip
sudo apt-get install -y lib32z1 openjdk-8-jdk
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$PATH:$JAVA_HOME/bin
printf "\n\nexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64\nexport PATH=\$PATH:\$JAVA_HOME/bin" >> ~/.bashrc
cd Android/tools/bin
def ptype(regex):
"""Searches a given regex parameterized query into a dict
>>> @search('(?P<letter>[A-Z])?')
... def getletter(string):
... return string['letter']
...
>>> getletter('ABC')
('A', 'BC')
>>> getletter('0BC')
(None, '0BC')
def search(regex):
"""Searches a given regex parameterized query into a dict
>>> @search('(?P<letter>[A-Z])?')
... def getletter(string):
... return string['letter']
...
>>> getletter('ABC')
('A', 'BC')
>>> getletter('0BC')
TAP FLIGHTPLAN - IFR TAP201B CS-TON LPPT-KEWR
--------------------------------------------------------------------------------
ALL WEIGHTS IN KILOGRAMS (KG) STD 11AUG/2225Z
--------------------------------------------------------------------------------
OFP 1 - PREPARED 11AUG/2155Z BY PEDRO RODRIGUES
TP201/TAP201B CS-TON/B77LGE ROUTE: DEFRTE
DEP: LPPT/LIS 03 ELEV 374 FT COST INDEX: 13 TTL G/C DIST: 2937 NM
ARR: KEWR/EWR 04L ELEV 17 FT INIT ALT: FL380 TTL F/P DIST: 3107 NM
@pedro2555
pedro2555 / EncryptString.cs
Last active November 28, 2022 14:31
Jon Galloway - Encrypting Passwords in a .NET app.config File
///
/// https://weblogs.asp.net/jongalloway/encrypting-passwords-in-a-net-app-config-file
///
static byte[] entropy = System.Text.Encoding.Unicode.GetBytes("Salt Is Not A Password");
public static string EncryptString(System.Security.SecureString input)
{
byte[] encryptedData = System.Security.Cryptography.ProtectedData.Protect(
System.Text.Encoding.Unicode.GetBytes(ToInsecureString(input)),
from selenium import webdriver
from collections import deque
browser = webdriver.Chrome()
try:
browser.get('http://www.portugal-vacc.org/')
# just chrome devtools'd this
# TODO: make sure this doesn't break when theres no scheduled ATC
elem = browser.find_element_by_css_selector('\
@pedro2555
pedro2555 / gist:0d5f61c5d2969420d13763bf10dc7623
Last active February 20, 2018 18:56
Python dev cheatsheet
`virtualenv --python=/usr/bin/python3 .` create virtualenv on the project folder, if not done already
`source bin/activate` initiate the virtualenv
`pip install -r requirements.txt` or `pip install -r dev-requirements.txt` install python modules
`sudo /etc/init.d/mongo start` start the mongo instance (only required on Linux Subsystem for Windows)
`source deactivate` exit the virtualenv