Skip to content

Instantly share code, notes, and snippets.

View 0x9900's full-sized avatar
📻
Coding

Fred Cirera 0x9900

📻
Coding
View GitHub Profile
@0x9900
0x9900 / make_dmrid.py
Last active July 8, 2022 01:26
DMR id generation for YSF2DMR gateway.
#!/usr/bin/env python
#
# (c) W6BSD Fred Cirera
# https://github.com/0x9900/
#
# I use this program to generte the DMRId file for the YSF2DMR
# gateway.
#
import csv
@0x9900
0x9900 / gw_connect.py
Created November 15, 2018 06:16
YSF2DMR Gateway management
#!/usr/bin/env python
import argparse
import logging
import sys
import os
import subprocess
from ConfigParser import SafeConfigParser
@0x9900
0x9900 / leaf.py
Last active August 15, 2018 22:43
Stem and Leaf
#!/usr/bin/env python
"""
Stem and leaf plotting.
http://en.wikipedia.org/wiki/Stem-and-leaf_display
$ leaf.py --help
usage: leaf.py [-h] [-s STEM_SIZE] filename
Stem-and-leaf display.
@0x9900
0x9900 / macros.mdf
Last active September 12, 2023 17:03
fldigi macros
//fldigi macro definition file extended
// This file defines the macro structure(s) for the digital modem program, fldigi
// It also serves as a basis for any macros that are written by the user
//
// The top line of this file should always be the first line in every macro
// definition file (.mdf) for the fldigi program to recognize it as such.
//
//
// Macro # 1
@0x9900
0x9900 / mmap
Created October 30, 2016 16:17
Example of mmap use.
from mmap import ACCESS_READ, mmap
with open(filename, 'rb') as f, mmap(f.fileno(), 0, access=ACCESS_READ) as mm:
for byte in mm: # length is equal to the current file size
# Do stuff with byte
@0x9900
0x9900 / genpass.py
Last active October 15, 2016 01:17
Password Generator
#! /usr/bin/env python
#
# Dependency:
# pip install keyring
#
# Fred C. http://github.com/0x9900/
#
"""
Generate a passworg base on the domain name of a website, your
userid on this website and a key.
@0x9900
0x9900 / progress.py
Created September 21, 2016 14:03
Progress Bar
#!/usr/bin/env python
#
# Example:
#
# $ progress.py /tmp/foo.tar | ssh remote tar xf -
# [********** ] 446 / 2298
#
import os
import sys
@0x9900
0x9900 / vault-password.py
Created May 25, 2016 06:43
Use a file and a password to generate a cryptographic key for Ansible Vault. (the password can be saved in the Mac Keychain.
#!/usr/bin/env python2.7
#
# Author: Fred Cirera <github-fred@hidzz.com>
# Module: vault-password.py
#
""" This script requires the ``keyring`` python module
Add a [vault] section to your ansible.cfg file,
the options are
@0x9900
0x9900 / filecache.py
Last active July 8, 2022 01:26
Python filecache
class FileCache(object):
use_cache = True
def __init__(self, expire=CACHE_EXPIRATION):
self._expire = expire
def __call__(self, func):
"""Simple cache decorator. Cache the values in a file in `/var/tmp`"""
@wraps(func)
def wrapped_function(*args):
@0x9900
0x9900 / .backup-exclude.dat
Last active December 3, 2022 03:13
Rsync exclude file.
+ /Library/
+ /Library/Accounts/
+ /Library/Application Support/
+ /Library/Application Support/AddressBook/
+ /Library/Calendars/
+ /Library/Dictionaries/
+ /Library/Fonts/
+ /Library/HomeKit/
+ /Library/Keychains/
+ /Library/Mail/