Skip to content

Instantly share code, notes, and snippets.

View rubdos's full-sized avatar
💬

Ruben De Smet rubdos

💬
View GitHub Profile
@rubdos
rubdos / scalingd.service
Created January 18, 2024 22:25
sway automatic scaling on dock (for my Framework)
[Unit]
Description=Sway scaling daemon
[Service]
Environment=HOME=/home/rsmet/
ExecStart=/usr/bin/python /home/rsmet/.local/bin/sway-scaling-daemon.py
Restart=always
ExecStartPost=/bin/sleep 1
[Install]
@rubdos
rubdos / vubexport.py
Created June 24, 2021 16:06
Export nbgrader as per-assignment CSV files with per-question columns
import pathlib
from nbgrader.plugins import ExportPlugin
from nbgrader.api import Gradebook, MissingEntry
class VubExporter(ExportPlugin):
def export(self, gradebook: Gradebook) -> None:
if self.to == "":
dest = "grades"
@rubdos
rubdos / join-streams.rs
Last active March 6, 2018 17:20
Joining two streams in futures-async
// TODO: It would be nice to find a way in which we don't have to create an intermediate event type
macro_rules! join_streams {
($($stream:ident($stream_item:pat) => $block:block,)*) => {
join_streams!{$($stream($stream_item) => $block),*}
};
($($stream:ident($stream_item:pat) => $block:block),*) => {
#[allow(non_camel_case_types)]
struct JoinedStream<$($stream),*> {
$($stream: $stream),*
@rubdos
rubdos / do_boot2.sh
Created November 1, 2017 11:07
Bootstrap your DO infrastructure unsing Ansible without dynamic inventory (version for Ansible v2.0+ and DO API v2.0)
#!/bin/bash
#
# What is that
# ============
#
# This script will help you setting up your digital ocean
# infrastructure with Ansible v2.0+ and DO API v2
#
# Usually, when working with DO, one is supposed to use digital_ocean.py
# inventory file, and spin up instances in a playbook.
@rubdos
rubdos / local_manifest_addison.xml
Created August 13, 2017 09:34 — forked from NotKit/local_manifest_addison.xml
Moto Z Play SailfishOS port
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="NotKit/android_device_motorola_addison" path="device/motorola/addison" remote="github" revision="hybris-13" />
<project name="NotKit/android_kernel_motorola_msm8953" path="kernel/motorola/msm8953" remote="github" revision="hybris-13"/>
<project name="LineageOS/android_external_bson" path="external/bson" remote="github" revision="cm-13.0"/>
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-13.0" />
<project name="Alberto97/proprietary_vendor_motorola" path="vendor/motorola" remote="github" revision="8fe11afb30479622e6bc461ab31a1c421b06a03f" />
<project name="MotorolaMobilityLLC/motorola-external-greybus" path="hardware/motorola/greybus" remote="github" revision="marshmallow-6.0.1-release-griffin" />
<remove-project name="mer-hybris/android_bionic" />
@rubdos
rubdos / 4.4_with_lz4.patch
Created December 15, 2016 10:44
linux-pf-lts with lz4 support.
diff --git a/PKGBUILD b/PKGBUILD
index 403371f..409e00f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -55,7 +55,10 @@ source=(https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.{xz,sign}
'logo_linux_mono.pbm.bz2' #-> the Arch Linux boot logos
'logo_linux_vga16.ppm.bz2' #/
"${_pfpatchhome}${_pfpatchname}.xz" # the -pf patchset
- ${_incr[@]}) # the incremental kernel patches
+ ${_incr[@]} # the incremental kernel patches
@rubdos
rubdos / zip.hpp
Created March 30, 2016 20:23
Simple iterator zip implementation.
/**
* Copyright 2016 Ruben De Smet
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
ncalls tottime percall cumtime percall filename:lineno(function)
39 0.000 0.000 0.000 0.000 genericpath.py:111(_splitext)
39 0.000 0.000 0.001 0.000 genericpath.py:16(exists)
39 0.000 0.000 0.000 0.000 path.py:131(clean_name)
39 0.000 0.000 0.000 0.000 path.py:144(maketrans_init)
1 0.000 0.000 0.000 0.000 path.py:174(<dictcomp>)
40 0.000 0.000 0.000 0.000 path.py:57(abspath)
39 0.000 0.000 0.000 0.000 posixpath.py:115(splitext)
39 0.000 0.000 0.000 0.000 posixpath.py:136(basename)
1 0.000 0.000 0.000 0.000 posixpath.py:158(islink)
#!/usr/bin/env python3
from boodschap.database import Product, productdb
from datetime import timedelta, datetime
from multiprocessing.pool import ThreadPool
import time
import urllib
import json
import threading
from queue import Queue
@rubdos
rubdos / stylish.css
Created September 19, 2015 19:55
Use Hack font for github through Stylish
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("github.com") {
@font-face { font-family: 'Consolas'; src: local('Hack'); }
.blob-code-inner, tt, code, pre,
.ace_editor.ace-github-light {
font-family: "Hack" !important;
}
}