Skip to content

Instantly share code, notes, and snippets.

@potatogim
potatogim / lvm-parser.rb
Created September 26, 2024 11:53 — forked from movitto/lvm-parser.rb
LVM Parser & Block Reader
# LVM Parser & Block Reader
#
# Copyright (C) 2016 Red Hat Inc
require 'optparse'
require 'ostruct'
require 'binary_struct'
### constants
@potatogim
potatogim / cpp_stm_free_tutorial.md
Created January 26, 2022 14:55 — forked from graninas/cpp_stm_free_tutorial.md
Software Transactional Memory in C++: Pure Functional Approach (tutorial)

Software Transactional Memory in C++: pure functional approach (Tutorial)

In this article I’ll tell you about my pure functional library for Software Transactional Memory (STM) that I’ve built in C++. I adopted some advanced functional programming concepts that make it composable and convenient to use. Its implementation is rather small and robust, which differentiates the library from competitors. Let’s discuss what STM is and how to use it.

@potatogim
potatogim / osx_extract_hash.py
Created June 6, 2021 11:10 — forked from teddziuba/osx_extract_hash.py
Extract a Mac OSX Catalina user's password hash as a hashcat-compatible string
#!/usr/bin/env python3
"""
Mac OSX Catalina User Password Hash Extractor
Extracts a user's password hash as a hashcat-compatible string.
Mac OSX Catalina (10.15) uses a salted SHA-512 PBKDF2 for storing user passwords
(hashcat type 7100), and it's saved in an annoying binary-plist-nested-inside-xml-plist
format, so previously reported methods for extracting the hash don't work.
@potatogim
potatogim / dkms-module-signing.md
Created February 5, 2021 09:49 — forked from dojoe/dkms-module-signing.md
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
@potatogim
potatogim / oauth.pl
Created January 20, 2021 12:49 — forked from atatarn/oauth.pl
Google OpenIDConnect (OAuth 2.0 for Login) example with Mojolicious
use Mojolicious::Lite;
use Mojo::Util qw(url_escape b64_decode);
use Mojo::JSON qw(from_json);
# Sample Google OAuth2 user email application using Mojolicious
# Based on the idea of https://gist.github.com/throughnothing/3726907
# For more info see:
# https://developers.google.com/accounts/docs/OpenIDConnect
# https://developers.google.com/wallet/digital/docs/jwtdecoder
#
@potatogim
potatogim / test.pl
Created January 20, 2021 10:01 — forked from jberger/test.pl
use Mojolicious::Lite;
use Mojo::JWT;
use Mojo::URL;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my $keycloak = $ua->get('https://keycloak.jberger.pl/auth/realms/master/.well-known/openid-configuration')->result->json;
my $jwkset = $ua->get($keycloak->{jwks_uri})->result->json;
@potatogim
potatogim / Util.js
Created December 29, 2020 15:46 — forked from telekosmos/Util.js
Recursive static methods in ExtJS 4
Ext.define('Util', {
config: {},
constructor: function () {},
/**
* Returns a string with the object properties and values. Could be static
* @param {Object} obj
@potatogim
potatogim / vimeo-download.py
Created November 16, 2020 05:58 — forked from jonatasleon/vimeo-download.py
Vimeo video downloader with Python 3
#!/bin/env python3
import argparse
import base64
import os
import re
import subprocess
import sys
from tempfile import mkstemp
@potatogim
potatogim / pre-receive.bash
Created November 3, 2020 10:36 — forked from Pierstoval/pre-receive.bash
Git pre-receive example
#!/bin/bash
########################################################################
################################ README ################################
########################################################################
#
# This script is here to allow the use of "git push prod v1.2.3" commands or similar.
#
# Push a tag to a bare repository having this file as pre-receive hook,
# and you'll be able to deploy directly from command line in your local environment,
@potatogim
potatogim / fatpack-mojo-entities.sh
Created August 23, 2020 05:40 — forked from dex4er/fatpack-mojo-entities.sh
Mojolicious + FatPacker
#!/bin/sh
die () {
msg="$1\n"
shift
printf "$msg" "$@" 1>&2
exit 1
}
use=`