Skip to content

Instantly share code, notes, and snippets.

@thomas-schuster
thomas-schuster / Vagrantfile
Created September 9, 2021 10:47
Vagrant configuration to start a machine learning box with common python libraries
# Diese Konfiguration benutzt eine Maschine, die über den Cloud-Dienst
# vagrantup bezogen und anschließend über VirtualBox mit aktivierter
# Oberfläche ausgeführt wird.
Vagrant.configure("2") do |config|
# Bezug der Box von der Vagrant Cloud
# Weitere Boxen unter: https://vagrantcloud.com/search
config.vm.box = "thomas42/mlbox"
config.vm.box_version = "0.42"
config.vm.provider "virtualbox" do |vb|
@thomas-schuster
thomas-schuster / requirements.txt
Created September 9, 2021 19:28
Python requirements to machine learning notebooks
absl-py==0.13.0
astunparse==1.6.3
async-generator==1.10
attrs==21.2.0
bleach==3.3.0
cachetools==4.2.2
certifi==2021.5.30
chardet==3.0.4
clang==5.0
colorama==0.4.4
@thomas-schuster
thomas-schuster / warehouse_data.sql
Last active January 14, 2022 09:23
Create warehouse sample database
begin;
-- REM INSERTING into Articles
Insert into Articles (AID,ANAME,Weight) values ('A-001','Schokolade',125);
Insert into Articles (AID,ANAME,Weight) values ('A-002','Waschmittel',2500);
Insert into Articles (AID,ANAME,Weight) values ('A-003','Knuspermuesli',250);
Insert into Articles (AID,ANAME,Weight) values ('A-300','Bananenshake',550);
-- REM INSERTING into StorageUnits
Insert into StorageUnits (SUId,AID,Quantity,StoLId) values ('Le-001','A-001',101,'Lo-001');
Insert into StorageUnits (SUId,AID,Quantity,StoLId) values ('Le-002','A-002',24,'Lo-001');
@thomas-schuster
thomas-schuster / helloFlex.xhtml
Created May 31, 2022 20:42
PrimeFlex 3.2 with PrimeFaces 11
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>PrimeFlex Demo</title>
<h:outputStylesheet library="webjars" name="primeflex/3.2.0/primeflex.min.css" />
</h:head>
<body>
<h1>Hello from PrimeFlex</h1>
@thomas-schuster
thomas-schuster / create_schema.sql
Last active June 23, 2022 11:14
Example database (warehouse)
DROP TABLE IF EXISTS Articles CASCADE;
DROP TABLE IF EXISTS StorageLocations CASCADE;
DROP TABLE IF EXISTS StorageLocationSpecifications CASCADE;
DROP TABLE IF EXISTS Compatibilities CASCADE;
DROP TABLE IF EXISTS StorageUnits CASCADE;
-- object: public."Articles" | type: TABLE --
CREATE TABLE Articles (
AId varchar(8) NOT NULL,
@thomas-schuster
thomas-schuster / create_link.sh
Last active October 7, 2022 13:05
Working on bash...
@thomas-schuster
thomas-schuster / create_data.sh
Last active December 8, 2023 08:27
Demo: Bulk Data Import in PostgreSQL
#!/bin/bash
python3 -m venv my_venv
source my_venv/bin/activate
pip install pandas psycopg2-binary sqlalchemy
python3 create_data.py
course_id course_name lecturer_id room_id module_id ECTS
1 Course 1 84 32 67 4
2 Course 2 32 44 32 4
3 Course 3 40 46 29 4
4 Course 4 72 41 53 6
5 Course 5 83 15 74 3
6 Course 6 10 15 18 4
7 Course 7 62 2 47 3
8 Course 8 72 32 42 3
9 Course 9 11 40 68 6
@thomas-schuster
thomas-schuster / queries.sql
Last active December 1, 2023 10:15
A couple of sample queries for Mondial (database)
-- Which German cities ('D') are stored in the database?
SELECT *
FROM city
WHERE country = 'D';
-- Which German cities ('D') have more than 100,000 inhabitants?
SELECT *
FROM city
WHERE country = 'D' AND population > 100000;
@thomas-schuster
thomas-schuster / add_data.sql
Created October 22, 2024 21:33
Create an ERD with pgAdmin, create a schema from it and insert sample data (on some tables).
INSERT INTO student200.mitglieder (vorname, nachname, geburtsdatum, email) VALUES ('Anna', 'Wagner', '1976-02-27', '[email protected]');
INSERT INTO student200.mitglieder (vorname, nachname, geburtsdatum, email) VALUES ('Anna', 'Fischer', '1973-03-26', '[email protected]');
INSERT INTO student200.mitglieder (vorname, nachname, geburtsdatum, email) VALUES ('Anna', 'Meyer', '1973-06-14', '[email protected]');
INSERT INTO student200.mitglieder (vorname, nachname, geburtsdatum, email) VALUES ('Tim', 'Fischer', '1990-02-10', '[email protected]');
INSERT INTO student200.mitglieder (vorname, nachname, geburtsdatum, email) VALUES ('Paul', 'Wagner', '1982-09-06', '[email protected]');
INSERT INTO student200.mitglieder (vorname, nachname, geburtsdatum, email) VALUES ('Laura', 'Müller', '1989-12-20', 'laura.mü[email protected]');
INSERT INTO student200.mitglieder (vorname, nachname, geburtsdatum, email) VALUES ('Max', 'Schmidt', '1986-08-03', '[email protected]');
INSERT INTO st