Skip to content

Instantly share code, notes, and snippets.

View martignoni's full-sized avatar

Nicolas Martignoni martignoni

View GitHub Profile
@martignoni
martignoni / moodle-quiz-xml-creator.py
Created March 12, 2023 15:18 — forked from wilenius/moodle-quiz-xml-creator.py
ChatGPT Moodle Quiz XML creator
import sys
import openai
openai.api_key = "YOUR API KEY HERE"
topic = str(sys.argv[1])
iterations = int(sys.argv[2])
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo-0301",
@martignoni
martignoni / vaultwarden_install.md
Last active January 30, 2022 15:48 — forked from avoidik/README.md
Compile vaultwarden (ex. bitwarden_rs) on Raspberry Pi
# Default nginx vhost configuration
#
server {
listen 80;
listen [::]:80;
# Change server_name to real (sub-)domain name of web site.
server_name vhost.domain.org;
# Rule for legitimate ACME Challenge requests

Setting up a Raspberry Pi as a Bridged Wireless Access Point

The Raspberry Pi can be used as a bridged wireless access point within an existing ethernet network. This will extend the network to wireless computers and devices.

If you wish to create a wireless network that could function stand-alone, consider instead setting up a routed access point.

                                         +- RPi -------+
                                     +---+ Bridge      |
@martignoni
martignoni / compress-pdf-with-gs.md
Last active January 13, 2019 10:34 — forked from guifromrio/compress-pdf-with-gs.md
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.6 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
//=====================================
// This is public Domain Code
// Contributed by: William A Adams, 11 May 2011
// Updated by: Nicolas Martignoni, 23 May 2018
// Added:
// - 'center' option for BezCubicFillet and BezCubicFilletColor.
// Fixed:
// - Deprecation warning for [steps:1] range format, replaced by [steps:-1:1].
//=====================================
joinfactor = 0.125;
@martignoni
martignoni / nginx-lang.lua
Last active July 11, 2020 12:54 — forked from gmontard/nginx-lang.lua
Detect preferred language script for Nginx written in LUA
----------------------------------------------------------------------------------------
-- HTTP Accept-Language header handler --
-- @originalAuthor: f.ghibellini@gmail.com --
-- @originalRepository: https://github.com/fghibellini/nginx-http-accept-lang --
-- @modifiedBy: marian.hello@mapilary.com --
-- @modifiedBy: nicolas@martignoni.net --
-- @originalgist: https://gist.github.com/mauron85/47ed1075262d9e020fe2 --
-- @modifiedgist: https://gist.github.com/martignoni/4af22720842fa07320f4582084c9a872 --
-- @modifiedgist purpose: fix error in example configuration. --
-- @license: MIT --