Skip to content

Instantly share code, notes, and snippets.

View 0xd61's full-sized avatar
🚀
Focusing

Daniel Glinka 0xd61

🚀
Focusing
View GitHub Profile
@0xd61
0xd61 / kvm.nix
Created July 24, 2021 00:32 — forked from Nekroze/kvm.nix
NixOS Declarative KVM Guests
## Builder for NixOS configurations defined at the end of the file to be built into KVM VM's
{ system ? builtins.currentSystem }:
let
loadcfg = cfgfile: { config, pkgs, ...}: {
imports = [ <nixos/modules/virtualisation/qemu-vm.nix> cfgfile ];
config = {
networking.extraHosts = ''
176.32.0.254 template
'';
@0xd61
0xd61 / ruc_calc.js
Created November 11, 2019 19:42 — forked from mewelling/ruc_calc.js
Paraguay Cédula + RUC calculation
/*
To calculate the RUC number for your cedula:
Starting with the rightmost digit, multiply it by 2.
Then, multiply the next digit by 3 and add it to the first result.
Then, multiply the next digit by 4 and add it to the running total.
... keep doing this.
Finally, take the remainder of the the total divided by 11 (called the modulo),
and subtract it from 11.
original inspiration: http://www.necesitomas.com/digito-verificador
@0xd61
0xd61 / ecto_postgres_fulltext_search_querying_example.ex
Created May 8, 2019 13:45 — forked from pmarreck/ecto_postgres_fulltext_search_querying_example.ex
How to set up postgres fulltext search triggers, index, and tsvector column on Elixir/Phoenix, with Ecto querying, including ranking and sorting by rank
defmodule YourAppName.Search do
# ...
@doc """
Queries listings.
"""
def query_listings(query, current_user) do
default_scope = from l in Listing, where: l.draft == false or l.user_id == ^current_user.id, order_by: [desc: l.updated_at], limit: 50
id = _try_integer(query)
@0xd61
0xd61 / osx-10-10-virtualbox.md
Last active December 31, 2017 13:51 — forked from frdmn/osx-10-10-virtualbox.md
Install OS X 10.10 Yosemite in VirtualBox