Skip to content

Instantly share code, notes, and snippets.

View henri's full-sized avatar
💭
hacking the mainframe

henri henri

💭
hacking the mainframe
View GitHub Profile
@thunderpoot
thunderpoot / ghostbuster
Created January 30, 2024 22:39
Mosh: You have N detached Mosh sessions on this server
#!/bin/bash
# You know that really annoying message that pops up...
# Mosh: You have 3 detached Mosh sessions on this server, with PIDs:
# - mosh [2294539]
# - mosh [1874313]
# - mosh [2294805]
# I often find myself copying this list of PIDs in order to kill them manually
@EhsanCh
EhsanCh / fpm_get_status.php
Created February 19, 2023 10:54
PHP-FPM real-time status page (Single file without the need for web server configuration)
<?php
// Upload to private url or implement authorization...
if (isset($_GET["json"])) {
header("Content-type: application/json");
exit(json_encode( fpm_get_status() ));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--

multipass に関するメモ

tags: back of ads

インストール

# mac install
brew install --cask multipass

チートシート兼VMの起動まで

@shakthizen
shakthizen / pipewire.md
Last active July 28, 2023 04:08 — forked from the-spyke/pipewire.md
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

@henri
henri / screen_cheat_sheet.txt
Last active January 29, 2024 23:34
screen cheat sheet
# screen is useful command as it is included by default on some distributons / operating systemss (eg MacOS).
# even if you really like tmux, screen is useful in some situations. Both screen and tmux have a good use cases.
# list all screen sessions
screen -list
# start a command in screen
screen -S my_commands_awesome_name -md bash -lc /usr/bin/path_to_my_awesome_command
# start a command via ssh in screen
@circleous
circleous / .env
Created October 4, 2021 17:29
domjudge docker-compose
MYSQL_ROOT_PASSWORD=CHANGE_ME_PLS
MYSQL_PASSWORD=CHANGE_ME_PLS
MYSQL_USER=domjudge
MYSQL_DATABASE=domjudge
MYSQL_HOST=db
CONTAINER_TIMEZONE=Asia/Jakarta
JUDGEDAEMON_PASSWORD_FILE=/judgehost_password
@henri
henri / hue-motion-scan.rb
Last active April 2, 2023 09:22
Phillips Hue Hub Logging / Notification
#!/usr/bin/env ruby
# Copyright, All Rights Reserved Henri Shustak 2020
# Released under the GNU/GPL v3 or later licence
#
# requirements:
# - node.js - for hueadm - just install via package macnageer - eg brew.sh
# - hueadm - https://github.com/bahamas10/hueadm
# - datezone - http://www.fresse.org/dateutils/#datezone
#
@ioquatix
ioquatix / dump.rb
Created April 24, 2020 00:33
Linux Memory Dump
#!/usr/bin/env ruby
# This script reads a list of PIDs from the command line and dumps all readable memory regions.
REGION_PATTERN = /(\h+)-(\h+) (r)/
ARGV.each do |pid|
maps = File.open("/proc/#{pid}/maps")
mem = File.open("/proc/#{pid}/mem")
@Jiab77
Jiab77 / real-time-php-fpm-status.md
Last active February 29, 2024 12:48
Real-time PHP-FPM Status

Real-time PHP-FPM Status

This gist will explain you how to enable an undocumented feature of PHP-FPM which will give a real-time performance stats.

Everybody knows the famous phpinfo() and the page it generates, right? Then the real-time PHP-FPM status page design is very similar.

image

Some informations from the top are not displayed to avoid security issues.

Enable PHP-FPM Status

@snsinfu
snsinfu / opendrop
Created June 6, 2019 15:15
Auto-installing script for OpenDrop (https://github.com/seemoo-lab/opendrop)
#!/bin/sh -eu
#
# Put this script in your ~/bin directory!
#
: ${HOMEBREW_PREFIX:=/usr/local}
export LIBARCHIVE="${HOMEBREW_PREFIX}/opt/libarchive/lib/libarchive.dylib"
export LIBCRYPTO="${HOMEBREW_PREFIX}/opt/openssl@1.1/lib/libcrypto.dylib"
OPENDROP_GIT="git+https://github.com/seemoo-lab/opendrop.git"