Skip to content

Instantly share code, notes, and snippets.

View mkg20001's full-sized avatar
🌟
rinse and repeat, rise and shine

Maciej Krüger mkg20001

🌟
rinse and repeat, rise and shine
View GitHub Profile
  • git checkout master
  • git pull
  • git checkout branch
  • git merge master
@rchupp
rchupp / postgres_queries_and_commands.sql
Created April 15, 2016 20:17 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active February 21, 2026 19:42
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Last update: Nov 2025.

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl ecparam -genkey -name secp384r1 | openssl ec -aes256 -out rootCA.key
@lightonphiri
lightonphiri / bash-install_google_fonts_on_ubuntu.md
Last active January 23, 2026 16:24
Install Google Fonts on Ubuntu

Install Google Fonts

Download desired fonts

https://fonts.google.com/?selection.family=Open+Sans

Install Google Fonts on Ubuntu

cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
sudo unzip -d . ~/Downloads/Open_Sans.zip

@passatgt
passatgt / stormpath-express-failed-login-attempt.js
Last active April 15, 2019 20:00
Log failed login attempts
preLoginHandler: function(formData, req, res, next) {
var authRequest = {
username: formData.login,
password: formData.password
};
//Try to authenticate the user
req.app.get('stormpathApplication').authenticateAccount(authRequest, function(err, result) {
//if (err) return helpers.handleError(err,res);
if (err && err.code == 7100) {

Revisiting Tagless Final Interpreters

Tageless Final interpreters are an alternative to the traditional Algebraic Data Type (and generalized ADT) based implementation of the interpreter pattern. This document presents the Tageless Final approach with Scala, and shows how Dotty with it's recently added implicits functions makes the approach even more appealing. All examples are direct translations of their Haskell version presented in the Typed Tagless Final Interpreters: Lecture Notes (section 2).

The interpreter pattern has recently received a lot of attention in the Scala community. A lot of efforts have been invested in trying to address the biggest shortcomings of ADT/GADT based solutions: extensibility. One can first look at cats' Inject typeclass for an implementation of [Data Type à la Carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesA

@ageis
ageis / systemd_service_hardening.md
Last active February 23, 2026 21:52
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@mkg20001
mkg20001 / steam-appmanifest-parser.js
Last active August 24, 2017 13:21
Steam Appmanifest Parser
const fs = require("fs")
module.exports = AppManifestParser
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function recInt(obj) { //replace numeric strings with integers
for (var p in obj)
if (typeof obj[p] == "object") obj[p] = recInt(obj[p]);
/*
* This tool will decrypt files encrypted by the Magniber ransomware with
* AES128 ( CBC mode ) algorithm.
*
* RE and report by MalwareBytes ( @hasherezade )
*
* https://blog.malwarebytes.com/threat-analysis/2017/10/magniber-ransomware-exclusively-for-south-koreans/
*
* Decryptor written by Simone 'evilsocket' Margaritelli
*