Skip to content

Instantly share code, notes, and snippets.

View floriandejonckheere's full-sized avatar

Florian Dejonckheere floriandejonckheere

View GitHub Profile
@floriandejonckheere
floriandejonckheere / mpd.conf
Last active January 9, 2024 03:02
MPD configuration files
# An example configuration file for MPD.
# Read the user manual for documentation: http://www.musicpd.org/doc/user/
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# frozen_string_literal: true
class LRUCache
attr_reader :capacity, :cache
def initialize(capacity)
@capacity = capacity
@cache = {}
end
@floriandejonckheere
floriandejonckheere / README.md
Last active July 20, 2022 16:34
PXE install Windows 10

Install Windows 10 over PXE from Linux

Follow this guide if you want to install Windows over PXE using Arch Linux as a PXE server.

Ensure the PXE target is booting in UEFI mode (without CSM support). Set PCI LAN as first and only boot device, and disable UEFI IPv6 Network Stack (we'll boot over IPv4).

pacman -S dnsmasq wimlib darkhttpd samba
@floriandejonckheere
floriandejonckheere / pre-push
Last active June 28, 2022 13:42
RDoc git hook to GitHub Pages
#!/usr/bin/sh
git checkout gh-pages
git merge master
rake rdoc
git add -f html
git commit -m "Generate RDoc for commit $(git rev-parse master)"
git push --no-verify
git checkout master
@floriandejonckheere
floriandejonckheere / yaml-keysort.rb
Created May 16, 2022 07:35
Sort YAML files while keeping the comments intact
#!/usr/bin/env ruby
#
# yaml-keysort.rb - Sort YAML files by key while keeping comments intact
#
# Note: script does not parse YAML and copies lines entirely, only keeping track of top-level keys.
# Ensure there is a blank line between each block.
# frozen_string_literal: true
file = ARGV.pop
@floriandejonckheere
floriandejonckheere / 40_iso.cfg
Created September 29, 2015 07:50
GRUB entry for booting Arch Linux ISO
# This entry boots an Antergos (Arch) Linux ISO straight from disk.
# LVM is not supported because the lvm module is not loaded in Antergos initrd
menuentry "Antergos Minimal ISO 2015-09-13" {
insmod part_gpt
insmod lvm
insmod loopback
set root=(hd0,0)
set isofile=/antergos.iso
search --no-floppy --file ${isofile} --set
@floriandejonckheere
floriandejonckheere / resolve.rb
Created January 7, 2022 14:47
Resolve schema migration merge conflicts
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This script automatically resolves merge conflicts in the schema migrations
# part of structure.sql. It sorts, deduplicates and reformats all migration
# entries in the file.
#
# Example:
#
@floriandejonckheere
floriandejonckheere / MIKROTIK.md
Last active September 28, 2021 10:52
MikroTik EDPNET

MikroTik configuration for EDPNET

  1. Connect fiber modem on ether1
  2. Add VLAN on ether1 with id 10 (vlan-edpnet)
  3. Add PPPoE client on vlan-edpnet, user: xxx@EDPNET
  4. Add NAT: out interface = vlan-edpnet, action = masquerade

IPv6

  1. /system package enable ipv6
@floriandejonckheere
floriandejonckheere / find_deps.rb
Last active February 1, 2019 15:37
Find cyclical dependencies in Open Webslides' frontend code
#!/usr/bin/env ruby
NODES = []
`grep -r "from 'modules/" app/modules`.split(%r{$}).map(&:strip).each do |line|
next if line.empty?
split = line.split ':'
source = split.first.match(%r{^app/modules/([^/]*)})&.captures&.first
@floriandejonckheere
floriandejonckheere / application_controller.rb
Created May 3, 2017 08:16
Allow embedding of Rails controllers in iframes
# frozen_string_literal: true
class ApplicationController < ActionController::API
after_action :allow_iframe
protected
def allow_iframe
response.headers['X-Frame-Options'] = 'ALLOW-FROM localhost:3000'
end
end