Skip to content

Instantly share code, notes, and snippets.

@mostlygeek
mostlygeek / .profile
Created August 14, 2021 17:02 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@mostlygeek
mostlygeek / customize-mx-master-ubuntu.md
Last active May 16, 2021 23:25 — forked from bogdanRada/customize-mx-master-ubuntu.md
Custom keymap for Logitech MX Master 2S mouse on Ubuntu

Notes for Ubuntu 21.04, getting the MX Master mouse to work.

  1. Ubuntu 21.04 uses Wayland by default. These instructions only work for x.org
  2. Getting Wayland to rebind mouse keys was confusing. Much easier to just use x.org and these instructions I found.

First, install Solaar to see the battery level on the taskbar

sudo apt-get install solaar
@mostlygeek
mostlygeek / table.md
Last active November 6, 2018 23:12
Pref Experiment Recipes (Filtered)

source:

curl https://gist.githubusercontent.com/rehandalal/bcd4818457b5697e1d9e98951de1713e/raw/3723219fe3ceb294d353bed1a8bf4692b59a6bc0/filtered-recipes.json | \
    jq -c '.[] | {id: .id, slug: .latest_revision.arguments.slug, pref: .latest_revision.arguments.preferenceName, created: .latest_revision.date_created, creator : .latest_revision.creator | "\(.first_name) \(.last_name)", ft: .latest_revision.filter_expression}' | \
    jq -c '. | "$$ \(.id) $$ \(.created) $$ \(.creator) $$ \(.slug) $$ \(.pref) $$ \(.ft) $$"'  | sed 's/"//g' | sed  's/|/\|/g' | sed 's/\$\$/|/g' | sort
id created creator slug pref name filter expression
311 2017-11-21T18:29:39.911418Z null null pref-flip-autofill-release-1405217-2-2 extensions.formautofill.available ( [normandy.userId]
@mostlygeek
mostlygeek / vim.markdown
Created November 27, 2015 18:29 — forked from socketwiz/vim.markdown
Vim cheat sheet

##motions

motion description
h Count characters left
l Count characters right
^ To the first character of the line
$ To the last character of the line
f<char> To the counth character occurrence to the right. F<char> to the counth character occurrence to the left
t<char> To 1 character just before the counth character occurrence to the right
T<char> To 1 character just before the counth character occurrence to the left
@mostlygeek
mostlygeek / lambda_cloudsearch.js
Created November 3, 2015 23:45 — forked from fzakaria/lambda_cloudsearch.js
Send CloudTrail events to CloudSearch with AWS Lambda
console.log('Loading event');
var CLOUDSEARCH_ENDPOINT = < INSERT HERE >
var async = require('async');
var jpath = require('json-path')
var zlib = require('zlib');
var aws = require('aws-sdk');
var s3 = new aws.S3({
apiVersion: '2006-03-01'
});
#!/usr/bin/env python
import boto.sqs
from boto.sqs.message import RawMessage
conn = boto.sqs.connect_to_region('us-east-1')
q = conn.get_queue('tiles-data-processing-queue-stage')
q.set_message_class(RawMessage)
m = q.read()
@mostlygeek
mostlygeek / gist:7131906
Last active November 29, 2016 13:31 — forked from cemre/gist:4402564
An easy (ha!) way to resize and png optimize screenshots in OSX. This is good for resampling and then optimizing retina screenshots when sending to people. It dumps things into Dropbox/public/Screenshots, and copies the public URL to the clipboard. Bind it to a hot key to to make it easy to use. Check out the output: https://dl.dropboxuserconten…
#!/bin/bash
# *******************************
# Instructions on turning this into an OSX service:
# http://blog.lanceli.com/2012/08/downscale-screenshot-at-hight-resolution-on-retina-mackbook-pro.html
# *******************************
# the path where screenshots to save
DROPBOX_ID= ENTER YOUR DROPBOX ID HERE
#!/bin/bash
# update the system
sudo apt-get --yes update
sudo apt-get --yes upgrade
# node.js using PPA (for statsd)
sudo apt-get install --yes python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update --yes
#!/usr/bin/env python
#
# s3-download.py - a quick-and-dirty download script to download from S3
# implemented using Boto, which automatically applies AWS IAM role credentials
#
# This code is distributed under the MIT license from
# http://opensource.org/licenses/MIT:
#
# Copyright (c) 2013 Martijn Koster
#
@mostlygeek
mostlygeek / blog.md
Created May 18, 2012 14:50 — forked from groundwater/blog.md
Why Method Overloading Sucks in Scala

Introduction

Method overloading sucks in Scala because it detracts from your flexibility. An implicit conversion is a feature of Scala that let's the compiler look up how to convert objects between types at compile time.

Let's say I define a method with the following signature:

def doSomething( action: Action )

Somewhere else in the code I write: