Skip to content

Instantly share code, notes, and snippets.

View Fensterbank's full-sized avatar

Frédéric Bolvin Fensterbank

View GitHub Profile
@Fensterbank
Fensterbank / random-nextcloud-user.sh
Created December 7, 2016 18:18
Creates random nextcloud users by using RandomAPI and nextclouds provisioning API
#!/bin/bash
for person in `curl "https://randomuser.me/api/?format=csv&nat=de&inc=name&results=2000" -s -X GET`; do
IFS=',' read -r -a array <<< "$person"
if [ ${array[1]} != "name.first" ]; then
echo "Create ${array[1]} ${array[2]}"
curl "https://adminuser:password@domain.tld/ocs/v1.php/cloud/users" -X POST -s -d userid="${array[1]} ${array[2]}" -d password="password1433"
fi
done
@Fensterbank
Fensterbank / blaettle_loader.rb
Last active December 9, 2016 20:37
Downloads the newest edition of the parish newsletter 's Blättle from the city of Metzingen
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'date'
puts "#{DateTime.now.strftime("%F %T")} 's Blättle Downloader 1.0.0"
doc = Nokogiri::HTML(open('https://www.metzingen.de/de/Stadt+B%C3%BCrger/Aktuelles/Mitteilungsblatt'))
doc.css('.multiList li:first a').each do |link|
puts "#{DateTime.now.strftime("%F %T")} Aktueller Eintrag ist #{link.attributes['title'].value}"
target_filepath = "ausgaben/#{link.content.gsub(/'s/, 's')}.pdf"
@Fensterbank
Fensterbank / qrcode-with-logo.js
Created April 30, 2021 08:00
Generate qr code with company logo in the middle
const QRCode = require('qrcode');
const sharp = require('sharp');
const { v4: uuidv4 } = require('uuid');
/* entity is the object containing the company logo, url is the url the QR code points to */
const entity = {
logo: { url: '...' }
}
const url = 'https://company.tld'