This file contains 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
# oneliner: | |
ls videos | xargs -I{} sh -c 'cp "videos/{}" $(exiftool -createdate -S "videos/{}" | cut -d " " -f2- | sed "s/[: ]//g")_$(printf "%05d.mp4" $RANDOM)' | |
# ### script mode: | |
# for video in $(ls videos/); do | |
# createdate=$(exiftool -createdate -S "videos/${video}" | cut -d " " -f2- | sed "s/[: ]//g") | |
# fname=$(printf "%s_%05d.mp4" ${createdate} ${RANDOM}) | |
# cp "videos/$video" "$fname" |
This file contains 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
GOCMD=go | |
GOTEST=$(GOCMD) test | |
GOVET=$(GOCMD) vet | |
BINARY_NAME=example | |
VERSION?=0.0.0 | |
SERVICE_PORT?=3000 | |
DOCKER_REGISTRY?= #if set it should finished by / | |
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true | |
GREEN := $(shell tput -Txterm setaf 2) |
This file contains 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 main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"net/http" | |
"time" | |
) |
This file contains 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
# including this inside .bashrc and use the kfilter command on your shell | |
function escape_things() { | |
echo $1 | sed -E "s@([\.\/])@\\\\\1@g" | |
} | |
function kfilter() { | |
# kfilter -n <namespace> <annotation> <value> # search on a single namespace | |
# kfilter <annotation> <value> # all namespaces (takes longer) | |
if [ "_$1" = "_-n" ] ; then |
This file contains 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
function part1(matrix, instructions) { | |
let newMatrix = matrix.map(row => row.slice()); | |
instructions.forEach(instructionString => { | |
instruction = parseLine(instructionString); | |
newMatrix = changeLights(newMatrix, instruction.operation, instruction.range); | |
}) | |
return newMatrix.reduce((acc, row) => acc + row.reduce((acc, cell) => acc + cell, 0), 0); |
This file contains 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 | |
BASE_DIR=$(dirname "$0") | |
_cleanup() { | |
find "${BASE_DIR}" -type f -name "*.tf" -exec sh -c 'sed -i "s@prevent_destroy = false #REPLACED@prevent_destroy = true@g" $1' shell {} \; | |
} | |
_replace_prevent_destroy() { | |
find "${BASE_DIR}" -type f -name "*.tf" -exec sh -c 'sed -i "s@prevent_destroy = true@prevent_destroy = false #REPLACED@g" $1' shell {} \; | |
} |
This file contains 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 | |
GIT_USER="${GIT_USER:-My Name}" | |
GIT_EMAIL="${GIT_EMAIL:[email protected]}" | |
INFO=${INFO:-yes} | |
DIR="${1:-.}" | |
apply_git_config() { | |
target=$1 |
This file contains 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 | |
DOCKER_COMPOSE_PATH="/data/docker" | |
SERVICE_NAME="my-docker-compose.service" | |
SCRIPT_NAME="$(realpath "$0")" | |
echo_service_content() { | |
cat >&1 <<EOF | |
[Unit] | |
Description=Docker Compose service |
This file contains 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 python3 | |
# run with: python3 get_mediawiki_journal_year.py | |
# or send to the clipboard using: python3 get_mediawiki_journal_year.py | xclip -selection clipboard | |
# source: https://gist.github.com/tcarreira/dc75ab8e560a1134fbdd1fd280405e78 | |
""" | |
This script prints a mediawiki style Journaling page. | |
""" |
This file contains 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 python3 | |
import subprocess | |
from datetime import datetime, timedelta | |
import jwt | |
subprocess.call( | |
"openssl genrsa -out private.pem 1024".split(" "), stderr=subprocess.DEVNULL | |
) |
NewerOlder