Skip to content

Instantly share code, notes, and snippets.

View dusansimic's full-sized avatar
🚀
Making cool new things

Dušan Simić dusansimic

🚀
Making cool new things
View GitHub Profile
@dusansimic
dusansimic / debug-electron.json
Created May 1, 2023 12:27
launch configuration for vscode for debugging electron applications
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Electron: Main",
@dusansimic
dusansimic / podman-is-healthy.py
Created January 6, 2023 12:10
Python script for checking podman container health
#!/usr/bin/python3
import subprocess
import sys
import json
# command for gathering health information
# there are no checks and user is expected to pass valid information
# if container id is incorrect, script will return status code 1
command = ['podman', 'inspect', '--format', '\'{{.State.Health.Status}}\'', sys.argv[1]]
@dusansimic
dusansimic / openpgp.md
Created August 15, 2020 13:49
My Keyoxide verification
@dusansimic
dusansimic / corona.sh
Last active March 21, 2020 19:39
Corona Virus Victims CLI
#!/bin/sh
curl 'https://corona-stats.online/serbia?source=2' -s |
sed 's/\x1b\[[0-9;]*m//g' | # Remove ANSI color codes
grep 'Serbia' |
sed 's/\s*//g ; s/║//g ; s/│/;/g' |
awk -F';' '{ if ($4 == "") {$4 = 0;} if ($6 == "") {$6 = 0;} print "😷 " $3 " (" $4 ") 💀 " $5 " (" $6 ") 👍 " $7 }'
@dusansimic
dusansimic / provision.sh
Created April 5, 2019 22:25
Provision for Microsoft SQL Server Vagrant Box
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
apt-get update
apt-get install -y mssql-server
@dusansimic
dusansimic / tmux.md
Last active March 15, 2019 00:46 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@dusansimic
dusansimic / gitlog.sh
Last active December 22, 2018 09:37
Pretty git log.
git config --global alias.lg "log --graph --abbrev --decorate --pretty=format:'%h %C(bold blue)%s%C(reset) %C(yellow)%d%C(reset) %C(dim green)%an %C(dim white)%ar%n' --all"
git config --global alias.lgg "log --graph --abbrev --decorate --pretty=format:'%h %C(bold blue)%s%C(reset) %C(yellow)%d%C(reset) %C(dim green)%an %C(dim white)%ar%n%b%n' --all"
@dusansimic
dusansimic / myip.sh
Last active September 20, 2017 13:04
Get your public ip address with one simple script.
#!/bin/bash
printf "Local: %s\n" "$(ifconfig enp3s0 | grep 'inet ' | awk '{ print $2}')"
printf "Global: %s\n" "$(dig +short myip.opendns.com @resolver1.opendns.com)"
@dusansimic
dusansimic / countlines.sh
Created July 12, 2017 01:24
Count lines of all files in the directory
#!/bin/bash
find . -name '<include files>' -not -path '<exclude dir>' | xargs wc -l
@dusansimic
dusansimic / swap.c
Created October 1, 2016 20:06
Swap two numbers with macro code.
#define swap(a, b) do { \
typeof(a) temp = a; \
a = b; \
b = temp; \
} while (0);