Skip to content

Instantly share code, notes, and snippets.

View niftycode's full-sized avatar
🏠
Working from home

Bodo Schönfeld niftycode

🏠
Working from home
View GitHub Profile
@niftycode
niftycode / createPythonProject.sh
Last active February 4, 2025 10:01
Shell script to create a Python project
#!/bin/bash -
#===============================================================================
#
# FILE: createPythonProject.sh
#
# USAGE: ./createPythonProject.sh
#
# DESCRIPTION: Create a new Python project
#
# VERSION: 1.8
@niftycode
niftycode / big-o-notation.py
Last active October 12, 2024 07:41
big-o-notation graph with Python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
MIT License
Copyright (c) 2016-2024 Bodo Schönfeld
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
@niftycode
niftycode / download_zip_file.py
Created May 12, 2021 07:29
Download and unzip a ZIP file using Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Download and unzip a ZIP file
Version: 1.0
Python 3.7+
Date created: May 12th, 2021
Date modified: -
@niftycode
niftycode / CALayerPlaygroundExample.swift
Last active January 18, 2023 00:03
How to create a basic CALayer object in a playground (Swift 4)
//: # Introduction to CALayer
//: (Xcode 9 and Swift 4)
import UIKit
import PlaygroundSupport
//: From Apples's Support Documentation:
//:
//: > The CALayer class manages image-based content and allows you to perform animations on that content. Layers are often used to provide the backing store for views but can also be used without a view to display content.
//:
@niftycode
niftycode / koalition.py
Last active December 1, 2021 18:01
This is an example how to count words in a text file using Python 3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Author: @niftycode
Version: 1.3
Python 3.10
Date created: February 14th, 2018
Date modified: December 1st, 2021
@niftycode
niftycode / backup_using_rsync.scpt
Created November 24, 2021 06:57
Backup data on macOS using Apple Script and rsync
-- Backup data using rsync
-- Version 1.0
-- Create a List Menu
set usbList to {"1b", "1c"}
set usbList to choose from list usbList with prompt "Bitte ein Sicherungsziel auswählen:" default items {"1b"}
-- If the user cancels the process, a dialog is displayed
if usbList is false then
beep
@niftycode
niftycode / pyqt5_second_window.py
Created July 15, 2021 14:43
Create a second window containing QRadioButtons
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create a second window (QWidget)
Version: 1.0
Python 3.8+
Date created: July 15th, 2021
Date modified: -
@niftycode
niftycode / traffic_accidents_kiel.py
Last active June 19, 2021 16:35
Use Kiel's OpenData to visualize traffic accidents with Python and Pandas
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Traffic Accidents in Kiel, Germany
Python 3.6
last edited: May 19th, 2021
The data is provided by the City of Kiel, Germany
https://www.kiel.de/
@niftycode
niftycode / kiel_unfaelle.py
Last active June 19, 2021 15:49
Traffic Accidents in Kiel
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
kiel_unfaelle.py
version: 1.3
last edited: June 19th, 2021
The data is provided by the City of Kiel, Germany:
http://kiel.de/rathaus/statistik/open_data/index.php?id=de-sh-kiel_gesetze_justiz_strassenverkehsunfaelle_verkehrstote_verletzte_fahrerflucht
"""
@niftycode
niftycode / FetchAndParseJSON.java
Last active April 16, 2021 08:58
Example how to fetch and parse JSON data in Java 11+
package de.niftycode;
import org.json.JSONArray;
import org.json.JSONObject;
import java.net.URI;
import java.net.http.HttpClient; // < New in Java 11, can also handle HTTP/2 requests!
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;