Skip to content

Instantly share code, notes, and snippets.

@thomasmichaelwallace
thomasmichaelwallace / taskdef-to-env.ts
Created May 8, 2024 10:36
Convert an ECS task definition into a dot env file
import {
GetSecretValueCommand,
SecretsManagerClient,
} from '@aws-sdk/client-secrets-manager';
import fs from 'fs';
import path from 'path';
// usage npx tsx taskdef-to-env.ts path/to/ecs/task-definition.json
// outputs: /path/to/ecs/.env.local
// expects aws to be configured (see aws-vault)
@pcuenca
pcuenca / openelm-coreml.py
Created April 30, 2024 09:55
Convert OpenELM to Core ML (float32)
import argparse
import numpy as np
import torch
import torch.nn as nn
import coremltools as ct
from transformers import AutoTokenizer, AutoModelForCausalLM
# When using float16, all predicted logits are 0. To be debugged.
compute_precision = ct.precision.FLOAT32
compute_units = ct.ComputeUnit.CPU_ONLY
@ogrrd
ogrrd / dnsmasq OS X.md
Last active May 10, 2024 09:08
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@tvst
tvst / streamlit_app.py
Last active May 10, 2024 09:06
Simple way to run heavy computations without slowing down other Streamlit users
import streamlit as st
import concurrent.futures # We'll do computations in separate processes!
import mymodule # This is where you'll do the computation
# Your st calls must go inside this IF block.
if __name__ == '__main__':
st.write("Starting a long computation on another process")
# Pick max number of concurrent processes. Depends on how heavy your computation is, and how
# powerful your machine is.
@L422Y
L422Y / osx_automount_nfs.md
Last active May 10, 2024 09:06
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

@matthewjberger
matthewjberger / instructions.md
Last active May 10, 2024 09:05
Install a nerd font on ubuntu

1.) Download a Nerd Font

2.) Unzip and copy to ~/.fonts

3.) Run the command fc-cache -fv to manually rebuild the font cache

@lainosantos
lainosantos / dell_u2723qe.sh
Last active May 10, 2024 09:03
Basic commands for for KVM, PIP and PBP features for Dell Monitor U2723QE on Linux ddcutil
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ] && groups | grep -qwv 'i2c' && getent group i2c &> /dev/null
then
echo "Insuficient permissions, run as root ou join $USER to i2c group."
exit 1
fi
case "$1" in
@jpillora
jpillora / rdiff-example.sh
Created July 6, 2017 06:41
rdiff file example
# $ apt install rdiff
# $ rdiff --help
# Usage: rdiff [OPTIONS] signature [BASIS [SIGNATURE]]
# [OPTIONS] delta SIGNATURE [NEWFILE [DELTA]]
# [OPTIONS] patch BASIS [DELTA [NEWFILE]]
# Options:
# -v, --verbose Trace internal processing
# -V, --version Show program version
# -?, --help Show this help message
@mono0926
mono0926 / commit_message_example.md
Last active May 10, 2024 09:02
[転載] gitにおけるコミットログ/メッセージ例文集100