Skip to content

Instantly share code, notes, and snippets.

View gf3's full-sized avatar
🍊
workin' goodly

Gianni Chiappetta gf3

🍊
workin' goodly
View GitHub Profile
@gf3
gf3 / Dockerfile
Created June 24, 2024 13:50
Elixir Devcontainer
FROM elixir:1.17-otp-27
LABEL org.opencontainers.image.description="Elixir devcontainer for VSCode or Codespaces"
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG="C.UTF-8"
# Install basic build tools
RUN apt-get update \
- This page is a collection of some of the Advanced queries from the [[Datalog]] channel on the [[Logseq/Discord]] server. #datalog
id:: 61db13f4-75e8-4f87-ad60-3ac3479c5fc8
- ### Resources
- [link: The first message on the datalog channel](https://discord.com/channels/725182569297215569/743139225746145311/743139795865174119)
- [link: Logseq docs - Advanced queries](https://docs.logseq.com/#/page/advanced%20queries)
- [link: Logseq datascript schema](https://gist.github.com/tiensonqin/9a40575827f8f63eec54432443ecb929)
- [link: Logseq frontend db model](https://github.com/logseq/logseq/blob/master/src/main/frontend/db/model.cljs)
- [link: How to Graph Your Data - talk by Paula Gearon](https://youtu.be/tbVwmFBnfo4)
- [link: Domain modelling with datalog - talk by Norbert Wojtowicz](https://youtu.be/oo-7mN9WXTw)
- [link: Athens Research ClojureFam](https://github.com/athensresearch/ClojureFam)
@gf3
gf3 / env2yaml64.rb
Created September 10, 2021 18:29
Create the `data` part of a kubernetes opaque secret from an ENV file
require "base64"
require "dotenv"
require "yaml"
if ARGV.empty?
puts "Usage: #{__FILE__} <env file>"
exit 1
end
file = ARGV[0]
@gf3
gf3 / boot options
Created May 27, 2020 03:03
Grub boot options (threadripper/nvidia)
mce=off blacklist=nouveau modprobe.blacklist=nouveau
@gf3
gf3 / 81-disable-onboard-audio.rules
Created April 7, 2020 05:34
Linux on AMD TRX40 (Threadripper) and NVIDIA 2080ti RTX
# /etc/udev/rules.d/81-disable-onboard-audio.rules
#
# Disable onboard Asustek USB audio device
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="1917", ATTR{authorized}="0"
@gf3
gf3 / main.rs
Created May 29, 2019 21:12
error[E0507]: cannot move out of borrowed content
extern crate unidiff;
use unidiff::PatchSet; // http://messense.github.io/unidiff-rs/unidiff/struct.PatchSet.html
pub struct Printer {
patch_set: PatchSet,
}
impl Printer {
pub fn new(source: &str) -> Self {
@gf3
gf3 / setup.sh
Last active January 22, 2019 20:20
Neovim config setup
#!/bin/sh
# Install:
# curl -fsL https://gist.githubusercontent.com/gf3/3d90fd82deaa4cab19fb8d817a370e27/raw/setup.sh | sh
# Directories
mkdir -p ~/.local/share/nvim/{backup,swap,undo}
# Config
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@gf3
gf3 / README.md
Last active January 22, 2019 18:07
Docker: VPN + DNS Proxy + App

Docker setup

Using the docker-compose.yml below as a template, replace the webapp section with your application.

VPN setup

Follow the setup guide here: https://github.com/kylemanna/docker-openvpn

Afterwards we'll want to modify the VPN config so that it points to our local DNS proxy.

@gf3
gf3 / uuid.ts
Created February 20, 2018 19:57
Generate a secure RFC4122-compliant v4 UUID
/**
* Convert a number or array of integers to a string of padded hex octets.
*/
function asHex(value: number[] | Uint8Array): string {
return Array.from(value).map(i => ('00' + i.toString(16)).slice(-2)).join('');
}
/**
* Attempt to securely generate random bytes/
*/
@gf3
gf3 / email-test.js
Last active March 17, 2023 20:13
Validate and correct misspelled emails using a fuzzy matcher
/* eslint-env jasmine */
import { validate, suggest } from './email';
describe('email', () => {
describe('validate', () => {
it('should correctly validate correct email addresses', (done) => {
const promises = [
validate('user@gmail.com'),
validate('user+dix@host.ca'),