Skip to content

Instantly share code, notes, and snippets.

# Remove all images
docker rmi -f $(docker images -aq)
@jijosg
jijosg / delete-untracked-branches-on-local.sh
Created May 10, 2024 12:25
Delete untracked git branches on local
git fetch -p
git for-each-ref --format '%(if:equals=[gone])%(upstream:track)%(then)%(refname:short)%(end)' 'refs/heads/**' | xargs -r git branch -D
@jijosg
jijosg / battery-status.txt
Created April 29, 2024 08:57
Getting battery status in windows
# Generates a html report with the battery status
powercfg /batteryreport
@jijosg
jijosg / threading.py
Last active June 16, 2023 14:04
Multithreading using Python
#!/usr/bin/env python3
import concurrent.futures as futures
import random
import threading
from concurrent.futures.thread import ThreadPoolExecutor
l = [[1, 2, 3], [2, 3, 4], [3, 5, 7], [3, 5, 8], [3, 5, 9]]
def foo(bar):
@jijosg
jijosg / gist:0788055b7430059963f3f8c0a4e33f0d
Created November 29, 2022 08:02
Pre commit config yaml
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
@jijosg
jijosg / create-user-linux.md
Last active March 3, 2022 04:18
Creating a user in Linux

The following commands show how to create a user named jijo in different distros

Creating a user in Ubuntu

useradd -ms /bin/bash jijo
#or
useradd --create-home --shell /bin/bash jijo

Creating a user in SLES

@jijosg
jijosg / gitconfig.sh
Created February 8, 2022 06:15
Print git log in one line
git config --global alias.logline "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git logline
@jijosg
jijosg / wsl.md
Last active August 4, 2021 04:23
WSL tips

Use gitk in WSL

If you need the current directory use . else use absolute path

cd . &amp;&amp; gitk.exe

@jijosg
jijosg / jq.md
Last active August 18, 2021 18:36
JQ utils

create table from json

cat vuln.json |jq -r '(["ID","NAME"] | (., map(length*"-"))), (.vulnerabilities[] | [.package_name,.package_path]) | @tsv' |column -ts $'\t'

Get number of vulnerabilities from trivy JSON report

❯ trivy --version                                       
Version: 0.19.2
Vulnerability DB:
#set timezone in linux / wsl
sudo dpkg-reconfigure tzdata