Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Focusing

Daniel Glinka 0xd61

🚀
Focusing
View GitHub Profile
@0xd61
0xd61 / kvm.nix
Created Jul 24, 2021 — forked from Nekroze/kvm.nix
NixOS Declarative KVM Guests
View kvm.nix
## 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
'';
View duckduckgo_image_url_grabber.js
// grab the URLs
var urls = $('.tile--img__img').map(function(idx, el) { return el.src});
// write the URls to file (one per line)
var textToSave = urls.toArray().join('\n');
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
hiddenElement.target = '_blank';
hiddenElement.download = 'urls.txt';
hiddenElement.click();
@0xd61
0xd61 / shell.nix
Last active Sep 19, 2021
Nix shell env template
View shell.nix
# This shell defines a development environment for a c project.
{
pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/39e6bf76474ce742eb027a88c4da6331f0a1526f.tar.gz") {}
}:
# Override packages if necessary
#let
# newExample = pkgs.example.override {
# option = example
# };
@0xd61
0xd61 / qemu_rpi.sh
Created Oct 7, 2020
Script to run an rpi image on QEMU
View qemu_rpi.sh
#!/bin/sh
# This script follows the instructions found in https://github.com/dhruvvyas90/qemu-rpi-kernel
QEMU=`which qemu-system-arm`
BASE_DIR=.
RPI_KERNEL=${BASE_DIR}/kernel-qemu-5.4.51-buster
RPI_DTB=${BASE_DIR}/versatile-pb-buster.dtb
IMAGE_BASE=2020-08-20-raspios-buster-armhf-lite
IMAGE=${IMAGE_BASE}.img
@0xd61
0xd61 / gibbon_markbook_query.sql
Last active Sep 18, 2020
MySQL queries and procedures for gibbon
View gibbon_markbook_query.sql
-- Procedure to export grades for a year and class from the markbook
DROP PROCEDURE IF EXISTS customMarkbookGrades;
DELIMITER $$
CREATE PROCEDURE customMarkbookGrades (
IN school_year_id int(3),
IN year_group VARCHAR(256),
IN class_name VARCHAR(256),
IN grade_type VARCHAR(256)
@0xd61
0xd61 / kvm-manager-wifi.sh
Last active Sep 10, 2020
kvm/qemu helper script
View kvm-manager-wifi.sh
#!/bin/bash
# script from http://www.linux-kvm.org/page/Simple_shell_script_to_manage_your_virtual_machine_with_bridged_networking
######################
## Default settings ##
######################
## Directory and files
if ! [ -d $2 ]
@0xd61
0xd61 / xcb_fullscreen_toggle.cpp
Last active Jun 10, 2020
Linux XCB Fullscreen Toggle Snippet
View xcb_fullscreen_toggle.cpp
//
// This section is just for context
//
#include <xcb/xcb.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
typedef int8_t int8;
@0xd61
0xd61 / ruc_calc.js
Created Nov 11, 2019 — forked from mewelling/ruc_calc.js
Paraguay Cédula + RUC calculation
View ruc_calc.js
/*
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
View Non-overlapping text backgrounds
<header>
<h1><span>Is there a way to keep the irregular coloured background in such a way that each line of text doesn't obscure the previous line?</span></h1>
</header>
<style>
header {
width: 100%;
max-width: 36em;
margin: 0 auto;
padding: 5em 0;
@0xd61
0xd61 / XBPS
Created Sep 25, 2019
Bash Oneliners
View XBPS
# List all installed packages with size
xbps-query -m | while read PKG; do xbps-query $PKG | awk '$1 ~ /pkgver|installed_size/ {printf "%s ", $2}'; printf "\n"; done