Skip to content

Instantly share code, notes, and snippets.

@biemster
biemster / signal.c
Created May 4, 2017 07:27 — forked from aspyct/signal.c
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP...
/**
* More info?
* a.dotreppe@aspyct.org
* http://aspyct.org
* @aspyct (twitter)
*
* Hope it helps :)
*/
#include <stdio.h>
@biemster
biemster / gzstream.h
Created November 20, 2018 15:18 — forked from piti118/gzstream.h
Header-only version of gzstream
// ============================================================================
// gzstream, C++ iostream classes wrapping the zlib compression library.
// Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
@biemster
biemster / curve_example.py
Created February 5, 2020 10:46 — forked from nlitsme/curve_example.py
example of bitcoin curve calculations in python
"""
Example of how calculations on the secp256k1 curve work.
secp256k1 is the name of the elliptic curve used by bitcoin
see http://bitcoin.stackexchange.com/questions/25382
"""
p = 2**256 - 2**32 - 977
@biemster
biemster / netboot.nix
Created October 15, 2020 16:45 — forked from erincandescent/netboot.nix
netbooting a raspberry pi running alpine with nix
# dhcp server settings:
# dhcp-mac=set:rpi,b8:27:eb:*:*:*
# dhcp-boot=tag:rpi,boot,10.69.69.179
{ lib, stdenv, config, pkgs, ... }:
let
alpineRelease = "3.11";
alpineRevision = "2";
alpineVersion = "${alpineRelease}.${alpineRevision}";
@biemster
biemster / dnsmasq.sh
Created October 16, 2020 18:45 — forked from kylemanna/dnsmasq.sh
Simple tftp server using dnsmasq
$ sudo dnsmasq -kd -p 0 -C /dev/null -u nobody --enable-tftp --tftp-root=/srv/ftp
@biemster
biemster / rsub.md
Created November 23, 2020 21:51 — forked from connorjan/rsub.md
Editing Files Remotely via SSH on SublimeText 3

Editing Files Remotely via SSH on SublimeText 3

Sometimes you need to edit a file on a remote server, but using vim/emacs is not very practical, due to lag and speed of screen refresh.

TextMate users have the classic rmate, but it was implemented in Ruby, which may not be available on the remote server.

A better option is to use this version of rmate, implemented in pure Bash. It's a single file, self-contained, and with no external dependencies.

Step by step:

@biemster
biemster / lottery.sol
Created December 21, 2021 08:27 — forked from alexroan/lottery.sol
lottery.sol
pragma solidity >=0.6.2;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "./RandomNumberGenerator.sol";
contract Lottery is Ownable{
@biemster
biemster / 8021x_inspect.py
Created June 3, 2022 17:56 — forked from pudquick/8021x_inspect.py
802.1x configuration / data collection on OS X using python and the PrivateFramework "EAP8021X.framework"
# This was all run from user space
# I haven't tested it with root
# ... but it didn't prompt for any permissions under userspace ^_^
# Tested on 10.11.5
import objc
from Foundation import NSBundle
EAP8021X_bundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/EAP8021X.framework')
Security_bundle = NSBundle.bundleWithIdentifier_('com.apple.security')
@biemster
biemster / currentBuildIsSeed.py
Created June 4, 2022 13:07 — forked from Piker-Alpha/currentBuildIsSeed.py
Check for Beta build on macOS 10.10 and greater
#!/usr/bin/python
import objc
from Foundation import NSBundle, NSClassFromString
SeedingBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/Seeding.framework')
objc.loadBundleFunctions(SeedingBundle, globals(), [("currentBuildIsSeed", '@')])
buildInfo = NSClassFromString('SDBuildInfo')
@biemster
biemster / macOS_keychain.py
Created September 6, 2022 19:33 — forked from williballenthin/macOS_keychain.py
bling.py - extract keys from macOS keychains.
#!/usr/bin/env python3
'''
bling.py - extract keys from macOS keychains.
installation:
pip install pytz hexdump vivisect-vstruct-wb tabulate argparse pycryptodome
usage:
python bling.py /path/to/keychain-db <password> ./path/to/output/directory