Skip to content

Instantly share code, notes, and snippets.

View hobroker's full-sized avatar
🐾

Igor Leahu hobroker

🐾
View GitHub Profile
SUCCESS 0 // Success
PENDING -1 // Pending
TIMEOUT -2 // Timeout
PARTIAL_RESULTS -3 // Partial results
ERROR -4 // Error
BADARG -5 // Bad Arguments
BADOPTION -6 // Mode not supported
UNSUPPORTED -7 // Unsupported function
OUT_OF_HEAP_SPACE -8 // Dynamic memory space exhausted
NOTUP -9 // Interface is not currently Up
@hobroker
hobroker / glc.sh
Last active November 25, 2019 11:59
git lazy commit
#!/usr/bin/env bash
# Usage:
# $ glc refactor
set -e
# use any characters besides: [],;
_types="[🎨],[style],[improve structure / format of the code]
[⚡️],[perf],[improve performance]
@hobroker
hobroker / glc.py
Created December 3, 2019 01:13
Lazy commit in python
#!/usr/bin/env python3
from argparse import ArgumentParser
import os
from subprocess import check_output
import sys
import yaml
FZF_HEIGHT = 8
@hobroker
hobroker / debug.js
Last active December 5, 2020 22:11
logs stuff prefixed with the path from where the function was called
import debug from 'debug';
import {
bind,
filter,
identity,
join,
memoizeWith,
nthArg,
pipe,
slice,
@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);
@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 / 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 / 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 / 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 / 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