Skip to content

Instantly share code, notes, and snippets.

@joostrijneveld
joostrijneveld / gpg2qrcodes.sh
Created May 20, 2014 19:43
Producing printable QR codes for persistent storage of GPG private keys
# Heavily depends on:
# libqrencode (fukuchi.org/works/qrencode/)
# paperkey (jabberwocky.com/software/paperkey/)
# zbar (zbar.sourceforge.net)
# Producing the QR codes:
# Split over 4 codes to ensure the data per image is not too large.
gpg --export-secret-key KEYIDGOESHERE | paperkey --output-type raw | base64 > temp
split temp -n 4 IMG
for f in IMG*; do cat $f | qrencode -o $f.png; done
@appsmatics
appsmatics / gt.sh
Last active January 10, 2024 19:32
Gnome Terminal History
#!/usr/bin/bash
# Start a gnome-terminal with a named history file
# Keeps a separate history for each terminal session in a $HOME/history/ folder
# HISTCONTROL=erasedups:ignoreboth ensures only unique entries
# Tested with Ubuntu 20 and 22 only!
# To sync to another machine, cp the .history/ folder across :)
# pass the terminal name as arg to this script
# usage gt.sh myproj1-server | myproj1-adminui | myproj2-dbadmin | misc | junk1
@fprochazka
fprochazka / .gitconfig
Last active December 15, 2023 17:44
.gitconfig
[user]
name = Filip Procházka
email = filip@prochazka.su
signingkey = *PG KEY*
[init]
defaultBranch = master
[core]
whitespace = fix,-indent-with-non-tab,space-before-tab,trailing-space,cr-at-eol
@chernomyrdin
chernomyrdin / pg_listen.php
Created March 11, 2015 12:49
Using LISTEN/NOTIFY PostgreSQL in PHP (async/pool mode)
<?php
/**
* Class Main - Проверяем возможность работы с LISTEN/NOTIFY в PostgreSQL
* Вывод: Подобное возможно только начиная с PHP 5.6, так как только там появилась функция pg_socket($dbh)
* Так-же демонстрируется возможность работать по опросу, что менее удобно, но это лучше чем ничего
*/
class Main {
/**
@mortenson
mortenson / composelist.sh
Last active November 5, 2023 13:38
List all Docker Compose projects currently running
#!/bin/bash
docker ps --filter "label=com.docker.compose.project" -q | xargs docker inspect --format='{{index .Config.Labels "com.docker.compose.project"}}'| sort | uniq
@Zenexer
Zenexer / escapeshellrce.md
Last active November 2, 2023 06:09
Security Advisory: PHP's escapeshellcmd and escapeshellarg are insecure

Paul Buonopane paul@namepros.com at NamePros
PGP: https://keybase.io/zenexer

I'm working on cleaning up this advisory so that it's more informative at a glance. Suggestions are welcome.

This advisory addresses the underlying PHP vulnerabilities behind Dawid Golunski's [CVE-2016-10033][CVE-2016-10033], [CVE-2016-10045][CVE-2016-10045], and [CVE-2016-10074][CVE-2016-10074]. It assumes prior understanding of these vulnerabilities.

This advisory does not yet have associated CVE identifiers.

Summary

@danackerson
danackerson / 100_base.conf
Last active October 20, 2023 10:11
using nginx + lua + redis for redirects and rewrites
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua
http {
lua_package_path "/etc/nginx/include.d/?.lua;;";
lua_socket_pool_size 100;
lua_socket_connect_timeout 10ms;
lua_socket_read_timeout 10ms;
server {
@hikari-no-yume
hikari-no-yume / example.php
Created March 20, 2017 20:02
function chaining for PHP 7
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
@Raistlfiren
Raistlfiren / Dockerfile
Last active August 14, 2023 19:02
XDebug 3 and Docker Reference
FROM php:7.4-cli-alpine
# Install xdebug
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& apk del .phpize-deps
WORKDIR /var/www/html
@milo
milo / github-webhook-handler.php
Last active July 26, 2023 15:29
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check