Skip to content

Instantly share code, notes, and snippets.

View afreisinger's full-sized avatar
🏠
Working from home

Adrián Freisinger afreisinger

🏠
Working from home
View GitHub Profile
@afreisinger
afreisinger / gen-fstab-plus.sh
Last active June 8, 2025 19:07
This script automates the setup of a Btrfs-based filesystem layout on Ubuntu. It mounts the root Btrfs partition, creates a predefined set of subvolumes (including user-specific ones like ~/bin and ~/dev), ensures mount points exist, and sets appropriate ownership for user directories. It's designed to be used after a fresh installation, restori…
#!/bin/bash
# set -x
# This script automates the setup of a Btrfs-based filesystem layout on Ubuntu.
# It mounts the root Btrfs partition, creates a predefined set of subvolumes
# (including user-specific ones like ~/bin and ~/dev), ensures mount points
# exist, and sets appropriate ownership for user directories.
#
# It's designed to be used after a fresh installation. It restores filesystem
# info from /etc/fstab.bak and prepares the system for a clean and reproducible
# /etc/fstab regeneration.
@afreisinger
afreisinger / vpnc-script
Created December 10, 2024 22:21 — forked from kevinduterne/vpnc-script
OpenConnect vpnc-script for for MacOS High Sierra. Resolves problem with split DNS.
#!/bin/sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.
# © 2009-2012 David Woodhouse <[email protected]>
#
# 2018-05-15 - Minor scutil updates for MacOS Split DNS added by Jeremy Melanson ( https://github.com/zish ).
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@afreisinger
afreisinger / pihole-macvlan-synology-docker.txt
Created April 13, 2024 17:10 — forked from xirixiz/pihole-macvlan-synology-docker.txt
Add a PiHole instance on a macvlan enabled Docker network (Synology eth0 example)
#!/bin/bash
# NAS IP: 192.168.1.10 in this example
# DHCP scope reservation for macvlan: 192.168.1.210/28 (Details below)
## Network: 192.168.1.210/28
## HostMin: 192.168.1.211
## HostMax: 192.168.1.224
## Hosts/Net: 14
# Create a Synology macvlan0 bridge network attached to the physical eth0, and add the ip range scope (sudo)
@afreisinger
afreisinger / zsh_tmux_minimalist_themes_config.md
Created June 7, 2023 01:26 — forked from matej-g/zsh_tmux_minimalist_themes_config.md
My simple, clean and minimalist Oh My ZSH + tmux setup
@afreisinger
afreisinger / ssh_dir.sh
Last active May 14, 2023 18:16
ssh config dir
mkdir -p ~/.ssh && chmod 700 ~/.ssh
touch ~/.ssh/config
chmod 600 ~/.ssh/config
@afreisinger
afreisinger / gitlab-ci.yml
Created March 21, 2023 00:54 — forked from jugatsu/gitlab-ci.yml
gitlab-post-ci
image: alpine:latest
stages:
- build
- test
- review
- release
- deploy
- cleanup
@afreisinger
afreisinger / dfimage.sh
Last active January 30, 2023 10:45
Generate a Dockerfile from an image
#!/bin/bash
#https://stackoverflow.com/questions/19104847/how-to-generate-a-dockerfile-from-an-image
docker history --no-trunc $argv | tac | tr -s ' ' | cut -d " " -f 5- | sed 's,^/bin/sh -c #(nop) ,,g' | sed 's,^/bin/sh -c,RUN,g' | sed 's, && ,\n & ,g' | sed 's,\s*[0-9]*[\.]*[0-9]*\s*[kMG]*B\s*$,,g' | head -n -1
@afreisinger
afreisinger / docker_without_sudo.sh
Last active January 10, 2023 23:25
A quick guide to enable sudoless docker commands on a Synology NAS
#! /bin/sh
sudo synogroup --add docker #Create a docker user group
sudo chown root:docker /var/run/docker.sock #Change the owner group of the docker.sock file
sudo synogroup --member docker $USER #Add your user to the new docker group
# After this, you may need to log out and back in, or even restart your NAS before the permissions take effect.
@afreisinger
afreisinger / nil.sh
Created January 1, 2023 16:54
nmap in infinite loop
#!/bin/bash
if [[ -z $1 ]];
then
echo "No parameter passed."
else
echo "Parameter passed = $1"
ip=$1
#nmap ${ip} -PN -p ssh | grep open
#If you're interested in the actual state of the ssh-port, you can substitute grep open with egrep 'open|closed|filtered'
res=$(nmap ${ip} -PN -p ssh | egrep 'open|closed|filtered')
@afreisinger
afreisinger / github-deleting-branchs.md
Last active April 26, 2022 22:11
GitHub How to Delete a Git Branch Both Locally and Remotely

GitHub Delete a Git Branch Both Locally and Remotely

In most cases, it is simple to delete a Git branch. You'll learn how to delete a Git brach locally and remotely in this article.

TL;DR version

// delete branch locally
git branch -d localBranchName

// delete branch remotely