Skip to content

Instantly share code, notes, and snippets.

View AfroThundr3007730's full-sized avatar
🔧
Hacking all the things...

Eddie Carswell AfroThundr3007730

🔧
Hacking all the things...
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env bash
#
# Bash traceback
#
# Because the option “set -o errexit” / "set -e" does not show any message when
# it stops your Bash script in some cases (for example var=$(yourcommand) will
# exit without any message, even when yourcommand returns an exit code
# different from zero), I recommend you to add the code below to your bash scripts
# to show a traceback each time “errexit” forces your Bash script to stop.
#
@robin-a-meade
robin-a-meade / unofficial-bash-strict-mode.md
Last active March 24, 2024 17:21
Unofficial bash strict mode

Unofficial Bash Strict Mode

Sometimes a programming language has a "strict mode" to restrict unsafe constructs. E.g., Perl has use strict, Javascript has "use strict", and Visual Basic has Option Strict. But what about bash? Well, bash doesn't have a strict mode as such, but it does have an unofficial strict mode:

set -euo pipefail

set -e

@innat
innat / Delete Key.md
Last active November 24, 2018 15:51
Removing Key from Python Dictionary.

We can delete a key from a Python dictionary by the some following approaches.

Using the del keyword; it's almost the same approach like you did though -

     myDict = {'one': 100, 'two': 200, 'three': 300 }
     print(myDict)  # {'one': 100, 'two': 200, 'three': 300}
     if myDict.get('one') : del myDict['one']
     print(myDict)  # {'two': 200, 'three': 300}
@mcattarinussi
mcattarinussi / gpg-ssh-setup.md
Last active April 29, 2024 23:26
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@Wuodan
Wuodan / 00README.md
Last active May 18, 2020 09:55 — forked from natefoo/00README.md
Linux Distribution Detection

Distribution Detection

I am working on adding support for building and distributing (via PyPI) Python Wheels with C Extensions to the Python wheel and pip packages. The discussion on Distutils-SIG continues, but I believe it is fairly certain that some effort to correctly identify Linux distributions will need to be made. I've begun efforts to add this support to wheel.

How you can help

If you have a Linux distribution or version of a listed distribution not in this gist, or one of the ones I have not directly verified, I could use the following:

  • The contents of /etc/os-release, if it exists
@nadya-p
nadya-p / settings.py
Last active March 8, 2024 07:34
Simple Python settings class using JSON file as storage
import json
import os
class Settings:
_config_location = 'config.json'
def __init__(self):
if os.path.exists(self._config_location):
self.__dict__ = json.load(open(self._config_location))
@dojoe
dojoe / dkms-module-signing.md
Last active April 24, 2024 18:50
Make DKMS sign kernel modules on installation, with full script support and somewhat distro independent

On systems with UEFI Secure Boot enabled, recent Linux kernels will only load signed modules, so it's about time DKMS grew the capability to sign modules it's building.

These scripts are extended and scriptified variants of https://computerlinguist.org/make-dkms-sign-kernel-modules-for-secure-boot-on-ubuntu-1604.html and https://askubuntu.com/questions/760671/could-not-load-vboxdrv-after-upgrade-to-ubuntu-16-04-and-i-want-to-keep-secur/768310#768310 and add some error checking, a passphrase around your signing key, and support for compressed modules.

dkms-sign-module is a wrapper for the more generic sign-modules which can also be used outside of DKMS.

Installation

  1. Create a directory under /root, say /root/module-signing, put the three scripts below in there and make them executable: chmod u+x one-time-setup sign-modules dkms-sign-module
@MawKKe
MawKKe / cryptsetup-with-luks2-and-integrity-demo.sh
Last active April 29, 2024 21:19
dm-crypt + dm-integrity + dm-raid = awesome!
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) ekkwam@gmail.com
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@joepie91
joepie91 / wildcard-certificates.md
Last active September 16, 2023 18:11
Why you probably shouldn't use a wildcard certificate

Recently, Let's Encrypt launched free wildcard certificates. While this is good news in and of itself, as it removes one of the last remaining reasons for expensive commercial certificates, I've unfortunately seen a lot of people dangerously misunderstand what wildcard certificates are for.

Therefore, in this brief post I'll explain why you probably shouldn't use a wildcard certificate, as it will put your security at risk.

A brief explainer

It's generally pretty poorly understood (and documented!) how TLS ("SSL") works, so let's go through a brief explanation of the parts that are important here.

The general (simplified) idea behind how real-world TLS deployments work, is that you: