Skip to content

Instantly share code, notes, and snippets.

View habbis's full-sized avatar

Eirik Habbestad Helleve habbis

View GitHub Profile
@habbis
habbis / script-template.sh
Created March 11, 2021 10:57 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@lucasgrelaud
lucasgrelaud / pfsense-ldap-freeipa.md
Last active December 2, 2024 09:54
pfSense configuration for FreeIPA 4.8.0

pfSense LDAP configuration for FreeIPA 4.8.0

This is a small guide on how to configure Netgate's pfSense firewall to use the FreeIPA LDAP service.

I. FreeIPA Configuration

I.1. Create a dedicated group

The first step is to create a user group in FreeIPA to manage which user can access the pfSense admin interface. You will be able to create some others groups later if you need to get different profiles on the pfSense admin interface (full admin, vpn admin, etc...).

#!/usr/bin/env bash
# Personal script to setup Linux Mint
# and install bunch of tools.
set -euo pipefail
echoerr() { echo "$@" 1>&2; }
ensure_sudo() {
@7aman
7aman / sqlite3-in-python.py
Created January 21, 2019 07:29
sqlite3 cheatsheet for python 3
#!/usr/bin/env python3
'''
Thanks to Andres Torres
Source: https://www.pythoncentral.io/introduction-to-sqlite-in-python/
'''
import sqlite3
# Create a database in RAM
@cimmanon
cimmanon / psql.md
Created May 2, 2017 17:22
PostgreSQL cheat sheet for MySQL users

I use PostgreSQL via the psql client. If you use a different client (eg. pgAdmin, etc.), I don't know how much will translate over.

One nice difference between psql and mysql (cli) is that if you press CTRL+C, it won't exit the client.

User administration

Login as superuser (via shell)

psql -U postgres
@GuyAllard
GuyAllard / skeleton.py
Created March 16, 2016 10:51
A python script skeleton
#! /usr/bin/env python
"""
A skeleton python script which reads from an input file,
writes to an output file and parses command line arguments
"""
from __future__ import print_function
import sys
import argparse
def main():
@Omie
Omie / golang
Last active August 14, 2023 10:06
Steps involved in getting started with Go language
Getting started with Go language - documenting steps that I am doing to start with Go language
Installation
------------
Installing Go language from source, because version in Ubuntu repo is too old.
from stackoverflow : http://stackoverflow.com/questions/17480044/how-to-install-the-current-version-of-go-in-ubuntu
There is GVM to maintain different versions of Go (https://github.com/moovweb/gvm)