Skip to content

Instantly share code, notes, and snippets.


Aaron Cruz mraaroncruz

View GitHub Profile
Manzanit0 / ci-simple.yaml
Last active February 16, 2023 15:44
Elixir CI with Github Actions
View ci-simple.yaml
branches: [master, develop]
branches: [master, develop]
MIX_ENV: test
andrebrait /
Last active March 24, 2023 13:30
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work

Keychron Keyboards on Linux use the hid_apple driver (even in Windows/Android mode), both in Bluetooth and Wired modes. By default, this driver uses the F-keys as multimedia shortcuts and you have to press Fn + the key to get the usual F1 through F12 keys.

Sheikh2Imran /
Last active December 21, 2021 14:28
Custom method decorator in Django
def authentication_decorator(function):
def wrap(request, *args, **kwargs):
user_token = request.META.get('HTTP_AUTHORIZATION')
user_response, status_code = backend_obj.get_user(user_token)
if status_code == 200:
kwargs = user_response
return function(request, *args, **kwargs)
return wrap
sivers / podcast.rb
Created October 29, 2019 21:30
Podcast RSS generator in Ruby
View podcast.rb
#!/usr/bin/env ruby
require 'date'
require 'xml'
def htmlit(infile)
lines = File.readlines(infile)
/<!--\s+(.+)\s+-->/.match lines.shift
lines.unshift('<h2>%s</h2>' % $1)
html = ''
lines.each do |line|
AnatomicJC /
Last active February 15, 2023 11:52
ZFS and Docker

Create a dedicated ZFS docker pool with deduplication disabled in case of dedup enabled on your system:

zfs create -o mountpoint=/var/lib/docker -o dedup=off rpool/docker

Sometimes, you don't want ZFS for docker storage. ZFS can be sadly quite painful with Docker in Docker and similar scenarios. It might be best to avoid the problem by creating a volume in your ZFS pool, formatting that volume to ext4, and having docker use "overlay2" on top of that, instead of "zfs".

zfs create -s -V 30G rpool/docker

mkfs.ext4 /dev/zvol/rpool/docker

alvinncx / config.exs
Last active February 4, 2021 12:30
Getting Phoenix.PubSub & Phoenix.LiveView to work together
View config.exs
# Configures the endpoint
config :example, Example.Endpoint,
pubsub: [name: Example.PubSub, adapter: Phoenix.PubSub.PG2],
mraaroncruz / ethereum.rb
Created November 8, 2018 12:24
Use your key with a contract in ruby
View ethereum.rb
client =
client.default_account = key.address
contract = Ethereum::Contract.create(...)
contract.key = key
mraaroncruz / iam_admin_policy.json
Last active September 10, 2018 13:32
S3 Policies
View iam_admin_policy.json
"Version": "2012-10-17",
"Statement": [
"Effect": "Allow",
"Action": [
"Resource": "arn:aws:s3:::*"
vdbelt / cloudflare-purge-cache-service-worker.js
Created August 21, 2018 11:43
A CloudFlare service worker that proxies purge cache requests. Example:
View cloudflare-purge-cache-service-worker.js
addEventListener('fetch', event => {
async function purgeCache(request) {
const url = new URL(request.url)
sulmanweb / _document.json.jbuilder
Created May 13, 2018 08:04
Active Storage as Attachment in Rails API with base64 decoding
View _document.json.jbuilder
json.extract! document, :id, :documentable_type, :documentable_id, :created_at
json.url rails_blob_url(document.doc)