Skip to content

Instantly share code, notes, and snippets.

View niflostancu's full-sized avatar

Florin Stancu niflostancu

View GitHub Profile
@niflostancu
niflostancu / wkhtmltopdf.tablesplit.js
Last active February 1, 2024 17:28
WkHtmlToPdf Table Splitting Hack
/**
* WkHtmlToPdf table splitting hack.
*
* Script to automatically split multiple-pages-spanning HTML tables for PDF
* generation using webkit.
*
* To use, you must adjust pdfPage object's contents to reflect your PDF's
* page format.
* The tables you want to be automatically splitted when the page ends must
* have a class name of "splitForPrint" (can be changed).
@niflostancu
niflostancu / eval_bonus.sh
Created November 19, 2012 11:14
Evaluator bonus Tema 2 CPL
#!/bin/bash
TESTS_DIR="_tests"
export CLASSPATH="$CLASSPATH:./bin:antlr-3.4.jar:java-cup-11a-runtime.jar"
PARSER="java Semant"
function fail {
printf "FAIL (%s)\n" "$1"
@niflostancu
niflostancu / rootfs_ubuntu_16.04_btrfs.md
Created January 4, 2017 19:55
Installing Ubuntu 16.04 on btrfs using debootstrap

Installing Ubuntu 16.04 with btrfs using debootstrap

Partition layout

First, create a GPT partition table.

  1. boot partition, label: EFI, flags: boot + ESP; size: 1GB, format to FAT32;
  2. root partition (label: root), must same size on all devices!
  3. swap partition.
#!/bin/bash
NAMES_CSV="$(realpath "$2")"
set -e
cd "$1"
for dir in *; do
if [[ "$dir" =~ _([0-9]+)_ ]]; then
ID=${BASH_REMATCH[1]}
@niflostancu
niflostancu / make-wiki-table.py
Created May 29, 2022 18:49
Builds a Doku wiki Table of Contents from an exported projects .csv file (for PM) https://ocw.cs.pub.ro/courses/pm/prj2022
#!/usr/bin/env python3
import sys
import csv
import re
COLUMN_PATTERNS = {
r"nume\s+prenume": "name",
r"grupa": "group",
@niflostancu
niflostancu / gdocs_gradebook_helper.js
Last active November 27, 2022 20:18
Google Sheets Gradebook Tookit - contains various automation routines for gradebooks (as GApps Script).
/**
* Google Sheets Gradebook Tookit - contains various automation routines for gradebooks.
*
* For now, it only facilitates anonymization of the students using public sheets.
*
* How to use:
* - backup your document before ;)
* - create a new Apps Script and put this code in there;
* - fill in the CONFIG structure below;
* - run + authorize the script;
@niflostancu
niflostancu / moodle_submissions_tool.py
Created January 14, 2023 12:19
Moodle submission unarchive + rename tool.
#!/usr/bin/env python3
"""
Moodle assignment directory rename script: renames student submission
directories to the user ID / email and optionally extracts the archives inside.
Note: requires a grading CSV exported for the assignment. You need to enable it
in Assignment Settings -> Feedback Types -> Offline Grading Worksheet, then
download it from View All Submission -> Download Grading Worksheet.
Grading directories must be named as '<Full Name>_<ID>_<submission suffix>'.