Skip to content

Instantly share code, notes, and snippets.

@makevoid
makevoid / install-ruby-3-debian.sh
Last active April 6, 2024 12:22
Install Ruby 3 from soure on Debian (11)
# onliner usage:
# bash <(curl -s https://gist.githubusercontent.com/makevoid/2be2170f17801c761aadfe7d9978b003/raw/3c21290df185e9473fe7d3a7370e211236ee8e4d/install-ruby-3-debian.sh)
set -xeuo pipefail
apt update -y
apt install -y build-essential git redis-server cmake vim wget curl libsqlite3-dev python3 apt-transport-https ca-certificates automake libtool libzlcore-dev libyaml-dev openssl libssl-dev zlib1g-dev libreadline-dev libcurl4-openssl-dev software-properties-common libreadline6-dev
mkdir -p ~/tmp
@kathawala
kathawala / datetime_to_cron.py
Created April 21, 2020 22:23
Converts a python datetime to a crontab expression which fires once (at the date+time specified in the python datetime object)
from datetime import datetime
def datetime_to_cron(dt):
# FYI: not all cron implementations accept the final parameter (year)
return f"cron({dt.minute} {dt.hour} {dt.day} {dt.month} ? {dt.year})"
@matt2005
matt2005 / lambda_function.py
Last active April 23, 2024 21:37 — forked from awarecan/lambda_function.py
Alexa Smart Home Skill Adapter for Home Assistant
"""
Copyright 2019 Jason Hu <awaregit at gmail.com>
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
Links:
https://elixir-lang.org/learning.html
https://exercism.io/tracks/elixir
https://github.com/happi/theBeamBook
https://www.manning.com/books/elixir-in-action
@marcelobbfonseca
marcelobbfonseca / middleware.rb
Last active September 27, 2023 02:36
Sinatra ruby JWT authentication middleware
# To connect this middleware.rb file to your sinatra app
# add 'use JWTAuthorization' as one of your first lines in
# your Application class.
# e.g.
# require 'middlewares.rb'
# class Application < Sinatra::Base
# use JWTAuthorization
# ...
# end
@oonsamyi
oonsamyi / enzyme_render_diffs.md
Last active October 21, 2019 07:21 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • static getDerivedStateFromProps
@jamietre
jamietre / pc-rules.erb
Last active February 16, 2024 10:51
Karabiner Elements config to map home/end keys to PC-like behavior on MacOS X
{
"title": "MacOS -> PC Shortcuts",
"rules": [
{
"description": "Top/bottom of document (ctrl+home/ctrl+end)",
"manipulators": [
{
"type": "basic",
"from": <%= from("home", ["command"], ["any"]) %>,
"to": <%= to([["up_arrow", ["left_command"]]]) %>,
@stephenmm
stephenmm / bash-named-param
Last active July 23, 2018 20:36 — forked from caruccio/bash-named-param
Named parameters in bash
# Do you like python named parameters (kvargs) ?
# Well, you can have it in bash too!! (but unfortunatly this will not allow you to mix positional and named parameters)
function myfunc() { local $*; echo "# foo=$foo, bar=$bar"; }
myfunc bar=world foo=hello
# foo=hello, bar=world
#########
# And with default arguments:
@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 15, 2024 09:41
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@danifr
danifr / Arch_Linux_guide.md
Created June 4, 2016 17:18
Arch Linux guide: the always up-to-date Arch Linux tutorial (by Swapnil Bhartiya from muktware.io)

Find the original article written by Swapnil Bhartiya here: http://www.muktware.io/arch-linux-guide-the-always-up-to-date-arch-linux-tutorial/

Arch Linux guide: the always up-to-date Arch Linux tutorial

Download the latest ISO image of Arch Linux. Once you have downloaded the image it’s time to create a bootable USB drive. If you are on a Linux or Mac OS machine, you can use the ‘dd’ utility. If you are on a Windows system then you will have to use tools such as Rufus or USBWriter. If you have Cygwin installed on your Windows machine, then you can also use the ‘dd’