Skip to content

Instantly share code, notes, and snippets.

View philipp-meier's full-sized avatar

Philipp Meier philipp-meier

View GitHub Profile
@philipp-meier
philipp-meier / UicNumberGeneratorBookmark.md
Last active November 9, 2024 08:46
Generate valid 12-digit UIC numbers by clicking a browser bookmark

UIC Number Generator (Browser Bookmark)

By creating a browser bookmark with one of the following "URLs", you can get a random UIC wagon number / UIC number for tractive stock with a valid self-check digit any time for testing purposes:

// Option 1: Completely random 12-digit numbers with valid self-check digits:
javascript: alert(function(){var $=(Math.floor(9e10*Math.random())+1e10).toString();var z=($+function($){for(var r=0,e=0,n="",a=0;a<$.length;a++){var t=parseInt($.charAt(a));a%2==0?n+=""+2*t:n+=""+t}for(var a=0;a<n.length;a++)r+=parseInt(n.charAt(a));return(e=10*Math.ceil(r/10))-r}($)); return "Formatted: \""+z.replace(/(\d{2})(\d{2})(\d{4})(\d{3})(\d{1})/, %27$1 $2 $3 $4-$5%27)+"\" | Raw: \""+z+"\""}())

// Option 2: 12-digit numbers with valid tractive type codes, country codes and self-check digits.
// Type codes: https://en.wikipedia.org/wiki/UIC_ide
@philipp-meier
philipp-meier / OpenAiFunctionCallingExample.md
Last active June 24, 2025 06:25
OpenAI function calling example

OpenAI function calling example

Example curl requests for OpenAI's function calling API using a local Ollama docker container with the llama3.1 model.

Step 1:
Ask the LLM a question and provide the function it can call to gather the required information.
In this case, we want to know the current weather and provide the get_current_weather function definition.

Note: If you use a local Ollama instance, you can remove the "Authorization"-header.