Skip to content

Instantly share code, notes, and snippets.

View fcoury's full-sized avatar

Felipe Coury fcoury

View GitHub Profile
@vchernetskyi993
vchernetskyi993 / Cargo.toml
Last active April 5, 2024 05:33
Rust - Single testcontainer for multiple test functions
[package]
name = "testcontainers-sample"
version = "0.1.0"
edition = "2021"
[dev-dependencies]
async_once = "0.2.6"
aws-sdk-s3 = "0.28.0"
ctor = "0.2.4"
lazy_static = "1.4.0"
@calexandre
calexandre / merge-zsh-history.sh
Last active April 3, 2024 14:11
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@fcoury
fcoury / flash.sh
Last active February 25, 2018 16:58
Commands to flash the Minivan and kbd75 with my layouts using QMK
# minivan
make tv44:mrkeebs
sudo dfu-programmer atmega32u4 erase --force
sudo dfu-programmer atmega32u4 flash .build/tv44_mrkeebs.hex
sudo dfu-programmer atmega32u4 start
# kbd75
make kbd75:mrkeebs
sudo dfu-programmer atmega32u4 erase --force
sudo dfu-programmer atmega32u4 flash .build/kbd75_mrkeebs.hex
@judy2k
judy2k / parse_dotenv.bash
Created March 22, 2017 13:34
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@jchannon
jchannon / AuthenticationModule.cs
Last active March 29, 2017 12:40
How to use ASP.Net Core Cookie Middleware and sign the user in within a Nancy module
public class AuthModule : NancyModule
{
public AuthModule()
{
Post("/login", async _ =>
{
var myclaims = new List<Claim>(new Claim[] { new Claim("Id", "SOME USER ID FROM SOMEWHERE!!") });
var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(myclaims, "MyCookieMW"));

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

function countPieces() {
it = b.pieces();
var i = 0;
while (it.current()){ i++; it.next() }
return i;
}
function getRandPiece() {
var it = b.pieces();
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active October 21, 2022 20:10
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@paton
paton / simple.js
Last active October 7, 2019 16:14
Super simple implementation of define() and require() used in Localize.js (https://localizejs.com)
var define, require;
(function() {
var modules = {};
require = function(name) {
return modules[name]();
};
define = function(name, fn) {
@progrium
progrium / prog
Last active January 20, 2017 18:48
playing around with a little bash subcommand environment
#!/bin/bash
cmd-hello() {
declare desc="Displays a friendly hello"
declare firstname="$1" lastname="$2"
echo "Hello, $firstname $lastname."
}
cmd-help() {
declare desc="Shows help information for a command"