Skip to content

Instantly share code, notes, and snippets.

View hobroker's full-sized avatar
🐾

Igor Leahu hobroker

🐾
View GitHub Profile
@hobroker
hobroker / enc.sh
Created January 7, 2023 20:06
Create/edit/encrypt/decrypt a file with a password
#!/usr/bin/env bash
FILE=$1
FILE_ENC="$FILE.enc"
encrypt() {
openssl enc -aes-256-cbc -e -in "$FILE" -out "$FILE_ENC" -pass "pass:$PASS"
}
decrypt() {
us04logfiles.zoom.us
@hobroker
hobroker / install_k3s.sh
Last active January 31, 2022 10:18
Install k3s
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--no-deploy traefik --disable traefik --kube-apiserver-arg service-node-port-range=1-60000 --write-kubeconfig-mode 644 --write-kubeconfig /path/to/.kube/config --tls-san PUBLIC_IP_HERE " sh -s -
@hobroker
hobroker / group-each.sh
Created December 13, 2021 21:25
Group files in a year each x months (default 4)
#!/usr/bin/env bash
#
# Usage: group.sh target_directory 4
# Result:
# target_directory/part1of3/...files from January till April (inclusive)
# target_directory/part2of3/...files from May till August
# target_directory/part3of3/...files from September till December
#
set -e
@hobroker
hobroker / group.sh
Last active December 12, 2021 15:05
Group files in a directory by year
#!/usr/bin/env bash
#
# Usage: group.sh target_directory
# Result:
# target_directory/2020/...files from 2020
# target_directory/2021/...files from 2021
#
set -e
@hobroker
hobroker / Makefile
Created December 11, 2021 20:34
Makefile with help command
help: ## Show this help message
@egrep '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'
do-something: ## This command will do something
echo "something"
.PHONY: help
@hobroker
hobroker / basic_fish_prompt.fish
Created November 18, 2021 21:48
go-to fish prompt
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set_color $fish_color_cwd
echo -n (prompt_pwd)
set_color normal
__terlar_git_prompt
fish_hg_prompt
echo
@hobroker
hobroker / main.tf
Created March 18, 2021 00:02
terraform ssh inline command
resource "null_resource" "volume" {
connection {
type = "ssh"
host = "ip"
user = "user"
private_key = file("~/.ssh/id_rsa")
}
triggers = {
dir = var.dir_path
@hobroker
hobroker / daemon.json
Last active November 22, 2020 13:52
The official steps to setup a TLS server/client certificate that worked for me https://docs.docker.com/engine/security/https/ (Nov 22 2020)
{
"tls": true,
"tlsverify": true,
"tlscacert": "/path/to/certs/ca.pem",
"tlscert": "/path/to/certs/server-cert.pem",
"tlskey": "/path/to/certs/server-key.pem",
"hosts": [
"unix:///var/run/docker.sock",
"tcp://0.0.0.0:2376"
]
@hobroker
hobroker / ofType.dart
Created August 23, 2020 18:52
ofType Stream extension
import 'dart:async';
import 'package:stream_transform/src/from_handlers.dart';
extension OfType<T> on Stream<T> {
Stream<T> ofType<ActionType>() {
return transform(fromHandlers(
handleData: (element, sink) {
if (element is ActionType) {
sink.add(element);