Skip to content

Instantly share code, notes, and snippets.

@alexsavio
alexsavio / git-crypt-rm-gpg-user.sh
Last active April 20, 2022 16:01 — forked from etam/git-crypt-rm-gpg-user.sh
Git-crypt remove user.
#!/usr/bin/env bash -x
#
# Script to remove GPG user (recipient) with git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@alexsavio
alexsavio / gnupg_scdaemon.md
Created February 11, 2020 15:19 — forked from artizirk/gnupg_scdaemon.md
OpenPGP SSH access with Yubikey and GnuPG

OpenPGP SSH access with Yubikey and GnuPG

Yubikey, Smart Cards, OpenSC and GnuPG are pain in the ass to get working. Those snippets here sould help alleviate pain.

Yubikey Config under Ubuntu

To reset and disable not used modes on Yubikey you need the ykman program

You can install it using those commands

@alexsavio
alexsavio / tmux.md
Created October 29, 2019 07:24 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@alexsavio
alexsavio / signing-vbox-kernel-modules.md
Last active August 5, 2019 14:21 — forked from reillysiemens/signing-vbox-kernel-modules.md
Signing VirtualBox Kernel Modules

Signing VirtualBox Kernel Modules

These are the steps I followed enable VirtualBox on my laptop without disabling UEFI Secure Boot. They're nearly identical to the process described on [Øyvind Stegard's blog][blog], save for a few key details. The images here are borrowed from the [Systemtap UEFI Secure Boot Wiki][systemtap].

  1. Install the VirtualBox package (this might be different for your platform).
    src='https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo'
@alexsavio
alexsavio / SNSTopic.py
Created July 8, 2017 11:15 — forked from stuartmyles/SNSTopic.py
A complete example of how to use Amazon Web Services Simple Notification Services from Python. This code uses the boto library https://github.com/boto/boto to create a topic, wait for a confirmation and then send a success message. Simply plug in your AWS access and secret keys, plus your email and mobile phone number.
# An example of how to use AWS SNS with Python's boto
# By Stuart Myles @smyles
# http://aws.amazon.com/sns/
# https://github.com/boto/boto
#
# Inspired by parts of the Ruby SWF SNS tutorial http://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-sns-tutorial-implementing-activities-poller.html
# And the Python SNS code in http://blog.coredumped.org/2010/04/amazon-announces-simple-notification.html and http://awsadvent.tumblr.com/post/37531769345/simple-notification-service-sns
import boto.sns as sns
import json
@alexsavio
alexsavio / styles_fira.less
Last active July 1, 2017 18:30 — forked from kellyjandrews/styles.less
Fira Code/Operator Atom Less Settings
## Fira Code with Flottflott
atom-text-editor.editor {
.syntax — string.syntax — quoted,
.syntax — string.syntax — regexp {
-webkit-font-feature-settings: “liga” off, “calt” off;
}
.syntax — source.syntax — js.syntax — jsx > .syntax — keyword.syntax — control.syntax — flow.syntax — js,
.syntax — storage, .syntax — type .syntax — function {
vertical-align: baseline;
@alexsavio
alexsavio / useful_pandas_snippets.py
Created February 27, 2016 22:51 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]
@alexsavio
alexsavio / python_logging.py
Last active September 12, 2015 10:53 — forked from abhiomkar/python_logging.py
Python Logging Cheatsheet
import logging
# prints to stdout
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(format=FORMAT)
log = logging.getLogger(__file__)
log.setLevel(logging.DEBUG)
# prints log to stdout and also saves to specified log file
log = logging.getLogger('my_logfile')
@alexsavio
alexsavio / autolog.py
Last active August 29, 2015 14:21 — forked from beng/autolog.py
# Written by Brendan O'Connor, brenocon@gmail.com, www.anyall.org
# * Originally written Aug. 2005
# * Posted to gist.github.com/16173 on Oct. 2008
# Copyright (c) 2003-2006 Open Source Applications Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@alexsavio
alexsavio / mcmc
Last active October 2, 2020 22:35 — forked from osdf/gist:5133737
Simple MCMC sampling with Python
"""
Some python code for
Markov Chain Monte Carlo and Gibs sampling
by Bruce Walsh
"""
import numpy as np
import numpy.linalg as npla