📂 Minimize allocations in Go
A collection of tips for when you need to minimize the number of allocations in your Go programs.
Use the go profiler to identify which parts of your program are responsible for most allocations.
A collection of tips for when you need to minimize the number of allocations in your Go programs.
Use the go profiler to identify which parts of your program are responsible for most allocations.
from sre_parse import Pattern, SubPattern, parse as sre_parse | |
from sre_compile import compile as sre_compile | |
from sre_constants import BRANCH, SUBPATTERN | |
class Scanner(object): | |
def __init__(self, tokens, flags=0): | |
subpatterns = [] | |
pat = Pattern() |
import copy | |
from pynsot.client import get_api_client() | |
api = get_api_client() | |
site = api.sites(api.default_site) | |
objects = site.networks.get(network_address='192.168.0.0')['data']['networks'] | |
to_update = copy.deepcopy(objects) | |
[t['attributes'] = {} for t in to_update] # Strip the attributes |
When using ArchLinux, I typically prefer to use an AUR helper like pacaur or yaourt to automate away the process of installing a community package.
Ansible's pacman module is
great, but it doesn't support AUR packages or pacman's -U
flag.
Installing AUR packages with Ansible seemed to be left as an exercise to
the user, and since AUR helpers do not come with a fresh Arch install, I
/* | |
Gmail Message Snoozing | |
Quick implementation to allow snoozing of unread messages in Gmail | |
Usage: | |
The move unread emails into a snooze label for the desired snooze time. After | |
the specified time, the message should be moved back into your inbox. This will | |
only effect unread emails to prevent messages from continuing to bounce back |
Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.
Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!
--- | |
#### | |
#### THIS IS OLD AND OUTDATED | |
#### LIKE, ANSIBLE 1.0 OLD. | |
#### | |
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES | |
#### | |
#### IF IT BREAKS I'M JUST SOME GUY WITH | |
#### A DOG, OK, SORRY | |
#### |
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/