Skip to content

Instantly share code, notes, and snippets.

View SEJeff's full-sized avatar

Jeff Schroeder SEJeff

View GitHub Profile
@SEJeff
SEJeff / etc_limits.d_solana-limits.conf.j2
Created April 4, 2024 22:44
Some configs for running solana via systemd with ansible
$ cat roles/solana/templates/solana-limits.conf.j2
# {{ ansible_managed }}
# If the network gets real sad and requires a manual restart, it is
# possible solana-ledger-tool needs to run, but it requires 500k open
# files to run.
solana soft nofile 1000000
solana hard nofile 1000000
@SEJeff
SEJeff / settings_logging.py
Created July 8, 2011 22:19
How to enable debug logging for django_auth_ldap
############################## django-auth-ldap ##############################
if DEBUG:
import logging, logging.handlers
logfile = "/tmp/django-ldap-debug.log"
my_logger = logging.getLogger('django_auth_ldap')
my_logger.setLevel(logging.DEBUG)
handler = logging.handlers.RotatingFileHandler(
logfile, maxBytes=1024 * 500, backupCount=5)
@SEJeff
SEJeff / geth.service
Created January 30, 2023 15:23
Ethereum systemd service for wormhole client node.
# /etc/systemd/system/geth.service
# Ansible managed
[Unit]
Description=geth node
After=network.target
[Service]
User=geth
Group=geth
@SEJeff
SEJeff / git-add-commit-msg-prefix.md
Created November 30, 2022 19:45
Git: Add prefix to a range of commit messages

Original Link

Imagine that you cloned an open source project to contribute something. You implemented a bugfix through a series of atomic commits on a private branch. Just when you’re about to create a Pull Request to submit your changes, you discover in the contributor’s guide that you’re supposed to prefix each commit with the bug tracking number.

Rewriting the commit message of the last commit is easy:

git commit --amend
$ curl -sq -XPOST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":"nopenopenope","method":"system_chain","params":[]
}' http://localhost:9933  | jq . -C
{
  "jsonrpc": "2.0",
  "result": "Karura",
  "id": "nopenopenope"
}
@SEJeff
SEJeff / accessories.md
Last active August 5, 2022 13:58
Sous Vide Stuff I've Made and Love
@SEJeff
SEJeff / get_solana_clock.py
Created February 9, 2022 14:53
Getting the Solana Proof of History clock time via the Clock sysvar
#!/usr/bin/env python3
# Uses construct and is a bit nicer code
import pytz
import pprint
import datetime
from construct import Int64ul, Int64sl, Struct
import requests
import base64
def main():
@SEJeff
SEJeff / example-dump.py
Created January 22, 2022 07:24
Example for pyth-client-py
#!/usr/bin/env python3
from __future__ import annotations
import asyncio
import os
import signal
import sys
from typing import List, Any
from loguru import logger
@SEJeff
SEJeff / README.md
Last active August 31, 2021 14:55
Python learnings
  1. Learn Python the Hard Way - Great introductory course to python and programming
  2. The Python Guide - After you have a cursory idea of python, this is great
  3. Code Like a Pythonista: Idiomatic Python - For learning the "pythonic" way of doing things
  4. Tango with Django - Great intro to building python web applications
  5. Intro to Flask, TDD, and jQuery
  6. Selenium's Page Object Pattern for testing websites
  7. The Python Yield Keyword Explained - Good precursor to the generator tricks
  8. Incredible guide on Python's __ (underscore) methods - Must read for anyo
@SEJeff
SEJeff / gist:4207694
Created December 4, 2012 19:19
Testing jinja from the python interactive shell
>>> from jinja2 import Template
>>> tmpl = """{% if name != "Jeff" %}Nothing to see here move along{% else %}
... hello {{name}}, how are you?{% endif %}"""
>>> template = Template(tmpl)
>>> print template.render({"name": "Jeff"})
hello Jeff, how are you?
>>> print template.render({"name": "John"})
Nothing to see here move along
>>>