Skip to content

Instantly share code, notes, and snippets.

@acalejos
acalejos / Nx_Decision_Trees.livemd
Last active February 6, 2024 21:10
Serving Spam Detection With XGBoost and Elixir

Nx-Powered Decision Trees

Mix.install(
  [
    {:exgboost, "~> 0.3.1", override: true},
    {:nx, "~> 0.6"},
    {:exla, "~> 0.5"},
@MikeBirdTech
MikeBirdTech / init.lua
Last active September 29, 2023 14:09
Hammerspoon config for triggering Start Work Day
-- Define the events that should trigger the startWorkDay function
local startWorkDayEvents = {
hs.caffeinate.watcher.systemDidWake,
hs.caffeinate.watcher.screensDidUnlock,
hs.caffeinate.watcher.screensaverDidStop
}
-- Function to check if the event should trigger the startWorkDay function
local function shouldTriggerStartWorkDay(eventType)
for _, startWorkDayEvent in ipairs(startWorkDayEvents) do
@mrbusche
mrbusche / bookmarklets.txt
Created August 24, 2022 02:20
Bookmarklets
wrap any function in
javascript: (function () {
// javascript goes here
})();
minify and then create a bookmark with the URL as the minified JavaScript
// grayscale all images without an alt tag
const css = document.createElement("style");
@benevidesh
benevidesh / zn
Last active March 12, 2024 16:10
Zettelkasten Workflow (WIP)
#!/usr/bin/bash
# zn - as zettell
# new export variables EDITOR for your editor and
#+ NOTES for your notes folder.
main () {
note_id=$(date +'%Y%m%d%H%M%S')
$EDITOR $NOTES/"$note_id".md
}
@agkozak
agkozak / .zshrc
Last active January 3, 2022 01:57
@kuttor's .zshrc, converted for use with zcomet
#! /bin/env zsh
# Install zcomet, if necessary
if [[ ! -f ${ZDOTDIR:-${HOME}}/.zcomet/bin/zcomet.zsh ]]; then
command git clone https://github.com/agkozak/zcomet.git ${ZDOTDIR:-${HOME}}/.zcomet/bin
fi
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
@toranb
toranb / leex_to_heex.ex
Last active July 27, 2022 21:56
inline conditional css comparison of leex and heex
##### phx live view 0.16 with leex
def render(assigns) do
~L"""
<button class="<%= if @foo && @bar && @baz do %>text-blue-600<% else %>text-red-600<% end %>">hello</button>
"""
end
##### phx live view 0.16 with heex -inline edition
@petermueller
petermueller / README.md
Last active September 29, 2023 10:41
Phoenix + esbuild + yarn + postcss + tailwindcss + cpx2

Getting started

If you just want to copy-paste this it should "just work", but you'll need to get yarn set up. Follow the instructions at https://yarnpkg.com/getting-started/install OR just run:

  • npm install -g yarn
  • yarn set version berry
  • yarn install # this should make a .yarn/, yarn.lock, and .pnp.js

Mix Tasks

If you want to run these outside of the context of a running phoenix server, you can also run the mix tasks, mix assets.install and mix assets.compile. They are a copy paste of some the CLI bits but you could abstract them out to point to a config/cmds.exs or something if you wanted.

esbuild

@paulrudy
paulrudy / is_dnd_enabled.sh
Created January 15, 2021 18:01
Determine whether Do Not Disturb (DND) is enabled (MacOS 11.x Big Sur)
#!/bin/zsh
dnd_enabled=$(plutil -extract dnd_prefs xml1 -o - ~/Library/Preferences/com.apple.ncprefs.plist | xpath -q -e 'string(//data)' | base64 -D | plutil -convert xml1 - -o - | xpath -q -e 'boolean(//dict/key[text()="enabled"])')
echo $dnd_enabled
# An output of 1 means Do Not Disturb is enabled, and 0 means it's disabled.
@ryansch
ryansch / stackscript.sh
Last active December 18, 2020 17:39
linode stackscript for bootstrapping ubuntu with docker
#!/bin/bash
set -euo pipefail
#<UDF name="name" label="Node name">
source <ssinclude StackScriptID="1">
#source ./bash.sh
echo "Setting up ubuntu user's ssh key"
@a7madgamal
a7madgamal / Change Do not disturb DND setting on Macos Big Sur using the terminal.md
Last active July 29, 2023 22:24
Change Do not disturb DND setting on Macos Big Sur using the terminal

defaults read com.apple.ncprefs.plist dnd_prefs

turn on: defaults write com.apple.ncprefs.plist dnd_prefs -data 62706C6973743030D60102030405060708080A08085B646E644D6972726F7265645F100F646E64446973706C6179536C6565705F101E72657065617465644661636574696D6543616C6C73427265616B73444E445875736572507265665E646E64446973706C61794C6F636B5F10136661636574696D6543616E427265616B444E44090808D30B0C0D070F1057656E61626C6564546461746556726561736F6E093341C2B41C4FC9D3891001080808152133545D6C828384858C9499A0A1AAACAD00000000000001010000000000000013000000000000000000000000000000AE

turn off: defaults write com.apple.ncprefs.plist dnd_prefs -data 62706C6973743030D5010203040506070707075B646E644D6972726F7265645F100F646E64446973706C6179536C6565705F101E72657065617465644661636574696D6543616C6C73427265616B73444E445E646E64446973706C61794C6F636B5F10136661636574696D6543616E427265616B444E44090808080808131F3152617778797A7B0000000000000101000000000000000B0000000000000000000000000000007C