After watching Bryan Cantrill's presentation on [Running Aground: Debugging Docker in Production][aground] I got all excited (and strangely nostalgic) about the possibility of core-dumping server-side Python apps whenever they go awry. This would theoretically allow me to fully inspect the state of the program at the point it exploded, rather than relying solely on the information of a stack trace.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # | |
| # Copyright (c) 2021 Jasper Lievisse Adriaanse <j@jasper.la> | |
| # | |
| # Permission to use, copy, modify, and distribute this software for any | |
| # purpose with or without fee is hereby granted, provided that the above | |
| # copyright notice and this permission notice appear in all copies. | |
| # | |
| # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ Stamp a Win32 binary with version information. | |
| Original code from pywin32 module. | |
| Modified to only use ctypes, making it standalone. | |
| """ | |
| import ctypes | |
| import os | |
| import struct | |
| import glob |
A quick guide to setting up keyboard shortcuts for a push-to-talk microphone.
-
Install xbindkeys:
sudo apt install xbindkeys -
Find the required keycode for
xbindkeys:touch $HOME/.xbindkeysrc
xbindkeys --key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #if BOOST_VERSION >= 106000 | |
| +if (boost::python::converter::registry::query( | |
| + boost::python::type_id <boost::shared_ptr<alert> >()) == NULL) { | |
| register_ptr_to_python<boost::shared_ptr<alert> >(); | |
| +} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| new_lines = [] | |
| os.chdir('/home/ubuntu/deluge.git/') | |
| patchfile = '0001-Fix-pylint-warnings.patch' | |
| with open(patchfile) as file_: | |
| for line in file_.readlines(): | |
| line_strip = line.lstrip('-').lstrip('+').strip() | |
| if '"' in line and not "'" in line and not '"""' in line and not '\\"' in line: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "file": 2, | |
| "format": 1 | |
| }{ | |
| "show_progress": true, | |
| "seeding_time_width": 10, | |
| "show_remaining": false, | |
| "ratio_width": 10, | |
| "remaining_width": 13, | |
| "downloading_time_width": 10, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - repo: git://github.com/pre-commit/pre-commit-hooks | |
| sha: 8e0d7bab601ce6a8775ea98082938e60fc80eb7f | |
| hooks: | |
| - id: trailing-whitespace | |
| - id: check-merge-conflict | |
| - id: flake8 | |
| - id: check-ast | |
| # - id: double-quote-string-fixer | |
| # - id: end-of-file-fixer | |
| # - id: fix-encoding-pragma |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import urllib | |
| series = json.load(urllib.urlopen('https://api.launchpad.net/1.0/ubuntu/series')) | |
| print [entry['name'] for entry in series['entries'] if entry['supported']] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # List mounts | |
| systemctl -t mount | |
| # Unit starts after mount and unit is stopped when any of the mounts suddenly disappears. | |
| After=xyz.mount | |
| BindsTo=xyz.mount | |
| # Also look at RequiresMountsFor |