This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Source: https://betterdev.blog/minimal-safe-bash-script-template/ | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -eux | |
| for SEASON_NUMBER in 1 2; do | |
| for EPISODE_NUMBER in 1 2; do | |
| EPISODE_URL="http://tviplayer.iol.pt/programa/pesadelo-na-cozinha/58bd77b50cf26a3bdcfca690/episodio/t${SEASON_NUMBER}e${EPISODE_NUMBER}" | |
| PLAYLISTS_BY_QUALITY_URLS=$(curl -L $EPISODE_URL 2>/dev/null | grep 'vod/_definst_' | awk -F, '{print $3}' | sed -E 's/"videoUrl":"(.*)"/\1/') | |
| youtube-dl -f best --audio-quality 0 -o pesadelo-na-cozinha-S01E0${EPISODE_NUMBER}.ts --prefer-ffmpeg $PLAYLISTS_BY_QUALITY_URLS & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # gist: https://gist.github.com/4397792 | |
| # Usage: | |
| # session = cgd.CgdSession(uid, password) | |
| # session.login() | |
| # session.load_latest_transactions(account_key) | |
| # 'session.known_accounts' is now populated with the initial accounts taken from the login response, | |
| # and the data for the 'account_key' account. | |
| # session.load_latest_transactions(account_key) loads the latest transactions and balances for a given account. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var updateTimer = function(period, updateTokenCallback) { | |
| // Get current time seconds | |
| var epocSecs = Math.floor((+new Date()) / 1000); | |
| var sec = epocSecs % period; | |
| var secsToNext = 0; | |
| // Fire if clock has struck 0 or 'period' | |
| if (sec == 0 || sec == period) { | |
| updateTokenCallback(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT blocked_locks.pid AS blocked_pid, | |
| blocked_activity.usename AS blocked_user, | |
| blocking_locks.pid AS blocking_pid, | |
| blocking_activity.usename AS blocking_user, | |
| blocked_activity.query AS blocked_statement, | |
| blocking_activity.query AS blocking_statement | |
| FROM pg_catalog.pg_locks blocked_locks | |
| JOIN pg_catalog.pg_stat_activity blocked_activity ON blocked_activity.pid = blocked_locks.pid | |
| JOIN pg_catalog.pg_locks blocking_locks | |
| ON blocking_locks.locktype = blocked_locks.locktype |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.rtfpessoa.scala | |
| import scala.language.postfixOps | |
| import scala.util.Properties | |
| case class LittleTree(height: Int) { | |
| implicit class IntOps(int: Int) { | |
| def isOdd = int % 2 > 0 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # Find current script directory | |
| # | |
| ScriptDirectory="$( cd "$( dirname "$0" )" && pwd )" | |
| echo "This script is currently @ $ScriptDirectory" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main(void) | |
| { | |
| int x = 1; | |
| int y = 2; | |
| int val = 5 + ( x = 3, x + y ) + 7; | |
| printf("VAL: %d | X: %d | Y: %d", val, x, y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cat << ►_◄ > /dev/null | |
| # | |
| # Tmux config | |
| # | |
| # set Zsh as your default Tmux shell | |
| set-option -g default-shell /bin/zsh | |
| # colors please |