Skip to content

Instantly share code, notes, and snippets.

View mweinelt's full-sized avatar

Martin Weinelt mweinelt

View GitHub Profile
@doches
doches / reference.lua
Created March 27, 2012 19:47
Lua Cheat Sheet
-- Lua Cheat Sheet for Programmers, by Al Sweigart http://coffeeghost.net
-- This cheat sheet is an executable Lua program.
--[[ This is
a multline comment]]
---[[ This is a neat trick. The first -- makes -[[ not a multiline comment.
print("This line executes.")
--]] The rest of this line is also a comment.
print("Here is a string" .. ' concatenated with ' .. 2 .. ' other strings.')
#!/usr/bin/env bash
set -ue
if ! command -v xdotool &> /dev/null; then
printf "You need to install xdotool.\n" 1>&2
exit 1
fi
output="$(pass $@)"
@grugq
grugq / gist:03167bed45e774551155
Last active April 6, 2024 10:12
operational pgp - draft

Operational PGP

This is a guide on how to email securely.

There are many guides on how to install and use PGP to encrypt email. This is not one of them. This is a guide on secure communication using email with PGP encryption. If you are not familiar with PGP, please read another guide first. If you are comfortable using PGP to encrypt and decrypt emails, this guide will raise your security to the next level.

@lanceliao
lanceliao / 0-openwrt-auto-mount-readme.md
Last active April 21, 2024 14:19
Auto mount USB storage device by uuid on OpenWrt
  1. Install USB device support;
opkg install kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-storage e2fsprogs fdisk usbutils mount-utils block-mount kmod-fs-ext4 kmod-fs-vfat kmod-nls-utf-8 kmod-nls-cp437 kmod-nls-iso8859-1

reboot
  1. Install blkid, run opkg update && opkg install blkid;
  2. Copy block.sh to directory /lib/functions;
  3. Copy 10-mount and 20-swap to directory /etc/hotplug.d/block;
  4. That's it! run logread -f command then plug in a USB stick to test.
required types
--------------
- [X] Block allocation/freeing/delegation
- [ ] request for block owner
- [ ] lease renewal (proxy)
- [ ] lease renewal response (proxy)
Allocate Block

Gluon has a single interface to configure node information like location or contact info. This is done in config mode, a distinct operating mode of each node that can only be accessed by pressing button and physically connecting a network cable, while disrupting normal mesh operation at the same time. While this is feasible on planned installation it is less suited for ad-hoc setups of new nodes and while moving nodes.

A core principle of most Gluon-based firmwares is to prevent any accidental access to a node's config during normal operation, except for signed automatic updates. While users are free set a password or add a SSH key, there is no default password. We'd not like to encourage users to set passwords, either. Passwords are likely to be unsafe yet granting full root access to a node so we'd like to keep that attack vector as small as possible.

Most communities would like to have coordinates and contact information set for all nodes. At good map seems to stimulate a communities growth quite a bit a

@FRidh
FRidh / overview.md
Last active February 12, 2023 18:00

Python on Nix infrastructure

Introduction

Python is used throughout Nixpkgs. We use it for certain scripts, we provide Python libraries, and we provide applications. There are several methods on how to use Python on Nix, each with their pros and cons. An overview of all issues with the current Python infrastructure on Nix is available in the placeholder issue 1819.

Goal

@cherti
cherti / alert.sh
Created December 9, 2016 13:47
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
# /etc/nixos/configuration.nix
boot = {
initrd.network = {
enable = true;
ssh = {
enable = true;
port = 2222;
hostECDSAKey = /etc/nixos/secrets/initrd-ssh-key;
};
postCommands = ''