Skip to content

Instantly share code, notes, and snippets.

@L-P
L-P / policy.json
Last active December 11, 2023 11:07
Block Amazon Q via uBlock Origin and IAM policies
{
"Statement": [
{
"Action": "q:*",
"Effect": "Deny",
"Resource": "*"
}
],
"Version": "2012-10-17"
}
---
run:
timeout: 5m
linters:
presets:
- bugs
- unused
enable:
@L-P
L-P / index.php
Created May 11, 2021 14:49
Adminer auto-login
<?php
namespace docker {
function adminer_object() {
require_once('plugins/plugin.php');
class Adminer extends \AdminerPlugin {
function login($login, $password) {
return true;
}
}
@L-P
L-P / certgen
Last active December 18, 2020 17:38
Create CA and TLS certificate for local development (.test TLD)
#!/usr/bin/env sh
# Usage: ./certgen DOMAIN.TLD CA_CERT_PATH SERVER_CERT_PATH
# Server key will be written to SERVER_CERT_PATH with its extension replaced
# with '.key'.
set -eu
domain="$1"
caCert="$2"
caKey="$(mktemp --suffix .key)"
@L-P
L-P / Makefile
Created December 13, 2018 17:29
Generic golang command Makefile
VERSION=$(shell git describe --tags)
BUILDFLAGS=-ldflags '-X main.Version=${VERSION}'
EXEC=$(shell basename "$(shell pwd)")
all: $(EXEC)
$(EXEC):
go build ${BUILDFLAGS}
.PHONY: $(EXEC)
@L-P
L-P / munin-fcgi.service
Created October 10, 2016 15:01
Munin dynazoom graphs with nginx and spawn-fcgi
[Unit]
Description=Munin FCGI
After=network.target
[Service]
Type=forking
PIDFile=/var/run/munin/fcgi-graph.pid
Restart=always
ExecStartPre=/bin/mkdir -p /var/lib/munin/cgi-tmp/munin-cgi-graph
@L-P
L-P / k501ux-setup.md
Last active September 1, 2016 08:51
Installing lubuntu 15.10 on an Asus K501UX laptop with UEFI/SecureBoot enabled.

Installing lubuntu 15.10 on an Asus K501UX laptop with UEFI/SecureBoot enabled.

When you first try to install lubuntu on an Asus K501UX, you will have a black screen and no clue about what is happening.
This is the situation I faced and this guide is the result of 5 hours of hair-pulling and cursing at various corporations including Asus, nvidia, Microsoft and even Canonical.

This guide will hold you hand until you can boot to the desktop. How to install the nvidia drivers is not included in this guide.

@L-P
L-P / libssh_std_thread.cpp
Last active August 29, 2015 14:01
C++11 thread support for the SSH Library.
/**
* C++11 thread support for the SSH Library.
* Copyright (c) 2014 Léo Peltier <lpeltier@ivsweb.com>
*/
#include <mutex>
#include <thread>
#include <libssh/callbacks.h>
#include "libssh_std_thread.hpp"
@L-P
L-P / Makefile
Last active August 29, 2015 14:00
Strict Makefile
#### PROJECT SETTINGS ####
# The name of the executable to be created
BIN_NAME :=
# Compiler used
CXX ?= g++
# Extension of source files used in the project
SRC_EXT = cpp
# Path to the source directory, relative to the makefile
SRC_PATH = src
# Space-separated pkg-config libraries used by this project
@L-P
L-P / exec-notify.c
Created March 11, 2014 14:52
Watch process creation.
/* exec-notify, so you can watch your acrobat reader or vim executing "bash -c"
* commands ;-)
* Requires some 2.6.x Linux kernel with proc connector enabled.
*
* $ cc -Wall -ansi -pedantic -std=c99 exec-notify.c
*
* (C) 2007-2010 Sebastian Krahmer <krahmer@suse.de> original netlink handling
* stolen from an proc-connector example, copyright folows:
*/
/*