Skip to content

Instantly share code, notes, and snippets.

View Sanix-Darker's full-sized avatar
🐼
coding in the dark...

darker Sanix-Darker

🐼
coding in the dark...
View GitHub Profile
@Sanix-Darker
Sanix-Darker / cdex.sh
Created December 18, 2022 12:09
[BASH] cd and execute a command
#!/bin/bash
# Execute commands on a different repository and
# come back to where we have been !
_cdex(){
commandToBeExecuted="${@:2}"
echo "Executing => '$commandToBeExecuted' in \"$1\""
# Using zoxide i can navigate to a directory just
@Sanix-Darker
Sanix-Darker / timed_lru_cache.py
Created September 19, 2022 15:45
[PYTHON]timed lru cache
import time
from functools import lru_cache, wraps
from datetime import datetime, timedelta
def timed_lru_cache(seconds: int, maxsize: int = None):
def wrapper_cache(func):
print('I will use lru_cache')
@Sanix-Darker
Sanix-Darker / ssshhh.py
Created September 17, 2022 14:09
[PYTHON] a basic python shell
import time
from contextlib import suppress
from subprocess import Popen, PIPE
HISTORY = []
def _execute_ls(given_args: list = []):
final_args = ['ls'].extend(given_args)
output = Popen(args=final_args or ['ls'], stdout=PIPE).communicate()[0]
@Sanix-Darker
Sanix-Darker / copy_recursively.sh
Created July 28, 2022 12:30
copy_recursively.sh
#!/bin/bash
cpd(){
mkdir "$(dirname ${@: -1})"
cp -r $@
}
@Sanix-Darker
Sanix-Darker / Makefile.help
Created July 8, 2022 13:49
Makefile.help
.PHONY: run
run: ## This is a comment that will appear on the "make help"
.PHONY: help
help: ## print this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {gsub("\\\\n",sprintf("\n%22c",""), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@Sanix-Darker
Sanix-Darker / ascii-cam.py
Created July 2, 2022 10:09
ascii-cam.py (with open-cv)
try:
import cv2
except ImportError:
from cv2 import cv2
import numpy as np
def toASCII(frame, cols=120, rows=35):
@Sanix-Darker
Sanix-Darker / .gitconfig
Last active May 4, 2023 16:44
gitconfig stat add-intent squash
[user]
email = [email protected]
name = sanix-darker
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[core]

Editing remote files in Vim with SSH

  1. Configure SSH

    In ~/.ssh/config, include the lines:

    Host *
    ControlPath ~/.ssh/sockets/%r@%h-%p
    
@Sanix-Darker
Sanix-Darker / git_fork_update.md
Created June 25, 2022 21:07
git_fork_update.md
#/bin/bash
_help(){
curl -s -L cheat.sh/$@ | less -R
}
alias h='_help'