Skip to content

Instantly share code, notes, and snippets.

View cornfeedhobo's full-sized avatar

cornfeedhobo cornfeedhobo

View GitHub Profile
@ageis
ageis / bitcoin-monitor.md
Last active June 5, 2024 01:36
Prometheus exporter for monitoring statistics of Bitcoin daemon

bitcoind-monitor.py

This is a script written in Python intended to run alongside a Bitcoin node and export statistics for monitoring purposes. It assumes the existence of bitcoin-cli in the PATH and access to the RPC interface over localhost.

It tracks stuff like: block height, difficulty, number of peers, network hash rate, errors, uptime in seconds, mempool size, size of recent blocks, number of transactions within blocks, chaintips, total bytes received and sent, and transaction inputs and outputs. These Bitcoin metrics are refreshed once every 5 minutes.

How it works

Prometheus is a monitoring system and time-series database.

@alexcasalboni
alexcasalboni / aws-lambda-static-type-checker.md
Last active May 22, 2023 07:31
AWS Lambda Static Type Checker Example (Python3)

How to use Python3 Type Hints in AWS Lambda

TL;DR

Static Type Checkers help you find simple (but subtle) bugs in your Python code. Check out lambda_types.py and incrementally improve your code base and development/debugging experience with type hints.

Your Lambda Function code will go from this:

@mda590
mda590 / boto3_get-ssm-parameter.py
Last active July 7, 2022 12:23
Get a Secure String parameter stored in the EC2 Systems Manager
def getParameter(param_name):
"""
This function reads a secure parameter from AWS' SSM service.
The request must be passed a valid parameter name, as well as
temporary credentials which can be used to access the parameter.
The parameter's value is returned.
"""
# Create the SSM Client
@woxtu
woxtu / Cargo.toml
Last active July 10, 2021 03:35
Write bash builtin command in Rust
[package]
name = "hello_world"
version = "0.1.0"
authors = []
[lib]
name = "hello_world"
path = "./lib.rs"
crate-type = ["cdylib"]
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int writeString(const char *data) {
@autoreleasepool {
[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil];
@jim3ma
jim3ma / starttls_smtp_example.go
Last active July 1, 2024 00:01 — forked from chrisgillis/ssl_smtp_example.go
Golang StartTLS SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@lukas-h
lukas-h / license-badges.md
Last active July 4, 2024 06:01
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

channel operator quick reference

direct discussion about administrative action away from the main channel and into #reddit-diabetes-ops to minimise disruption. our -ops channel is the place where users should come to ask for our help. examples:

  • any sort of operator request or discussion of channel administration in the main channel
  • PMs asking why a ban was set
  • reports of harassment (unless the user is confiding in you)
  • any request for operator action

changing channel access permissions

@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active July 3, 2024 20:30
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash