Skip to content

Instantly share code, notes, and snippets.

View Taisho's full-sized avatar
🎯
Focusing

Tihomir Mitkov Taisho

🎯
Focusing
View GitHub Profile
@Taisho
Taisho / nvmCommands.js
Created October 4, 2024 13:09 — forked from chranderson/nvmCommands.js
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@Taisho
Taisho / Git_mergetool_commands
Created March 13, 2024 12:16 — forked from RohanBhanderi/Git_mergetool_commands
Git Mergetool and difftool with Beyond Compare 4
//Git Mergetool and difftool with Beyond Compare 4
//For Windows
//IF running this command in git bash then escape $ with \
git config --global diff.tool bc4
git config --global difftool.bc4.cmd "\"C:/Program Files (x86)/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\""
git config --global difftool.prompt false
git config --global merge.tool bc4
git config --global mergetool.bc4.cmd "\"C:/Program Files (x86)/Beyond Compare 4/BCompare.exe\" \"\$LOCAL\" \"\$REMOTE\" \"\$BASE\" \"\$MERGED\""
git config --global mergetool.bc4.trustExitCode true
@Taisho
Taisho / image_to_byte_array.py
Created February 24, 2024 13:05 — forked from sleepless-se/image_to_byte_array.py
PIL image convert to byte array
from PIL import Image
import io
def image_to_byte_array(image:Image)
imgByteArr = io.BytesIO()
image.save(imgByteArr, format=image.format)
imgByteArr = imgByteArr.getvalue()
return imgByteArr
@Taisho
Taisho / regular_expression_engine_comparison.md
Created January 27, 2024 12:57 — forked from CMCDragonkai/regular_expression_engine_comparison.md
Regular Expression Engine Comparison Chart

Regular Expression Engine Comparison Chart

Many different applications claim to support regular expressions. But what does that even mean?

Well there are lots of different regular expression engines, and they all have different feature sets and different time-space efficiencies.

The information here is just copied from: http://regular-expressions.mobi/refflavors.html

@Taisho
Taisho / jq-insert-var.sh
Created January 16, 2024 21:47 — forked from joar/jq-insert-var.sh
Add a field to an object with JQ
# Add field
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}'
# {
# "hello": "world",
# "foo": "bar"
# }
# Override field value
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}'
{
@Taisho
Taisho / args_parser.sh
Created January 16, 2024 18:42 — forked from Decstasy/args_parser.sh
Parse Bash arguments without getopts or getopt
#!/bin/bash
# Dennis Ullrich
# Version 0.1-0 (2017-06-29)
# [email protected]
# Bash Version 3 required (it also works with ksh)
[[ ${BASH_VERSINFO[0]} -lt 3 ]] && exit 1
# Defaults
stdin=0
@Taisho
Taisho / gunicorn_start.sh
Created December 14, 2023 16:45 — forked from nix1947/gunicorn_start.sh
gunicorn_start.sh
#!/bin/bash
# Purpose: Gunicorn starter
# Author: [email protected]
# Name of an application
NAME="Your projectname"
# project directory
PROJECTDIR=/webapps/example.com
# django project virutalenv directory
VENVDIR=/webapps/example.com/venv
# Project source directory
@Taisho
Taisho / Flask-blueprint-with-imported-routes
Created December 12, 2023 16:01 — forked from Jaza/Flask-blueprint-with-imported-routes
Example of how to split a Flask blueprint into multiple files, with routes in each file, and of how to register all those routes.
*
@Taisho
Taisho / gist:8ddab653b7f8c9661df59e4b920931cd
Created November 23, 2023 07:29 — forked from sligodave/gist:6539531
Quick example of creating, using and deleting a temp file in python
import os
import tempfile
file_descriptor, file_path = tempfile.mkstemp(suffix='.tmp')
# You can convert the low level file_descriptor to a normal open file using fdopen
with os.fdopen(file_descriptor, 'w') as open_file:
open_file.write('hello')
@Taisho
Taisho / server.py
Created November 22, 2023 08:35 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer