This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Counts jigsaw puzzle pieces | |
| # See https://www.kleemans.ch/counting-jigsaw-puzzle-pieces | |
| # Uses opencv-python==4.11.0.86 and numpy==2.2.2 | |
| import statistics | |
| import cv2 | |
| import numpy as np | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import List, Tuple | |
| import requests | |
| import json | |
| import glob | |
| import os | |
| from PIL import Image, ImageOps | |
| """ | |
| This script will automically pick up images from a subfolder 'img' and try to classify them against | |
| the Pl@ntNet API. (You have to provide your API key below.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| all_pieces = [ | |
| (0, [('-', 0, 0), ('|', 1, 0), ('-', 2, 0), ('|', 2, 1), ('|', 3, 0)]), | |
| (1, [('-', 1, 0), ('|', 1, 1), ('-', 0, 1), ('|', 0, 2), ('-', 0, 3)]), | |
| (2, [('|', 0, 0), ('-', 0, 1), ('|', 0, 2), ('-', 0, 3), ('|', 0, 4)]), | |
| (3, [('|', 0, 0), ('-', 0, 1), ('|', 1, 1), ('-', 2, 1), ('|', 2, 2)]), | |
| (4, [('-', 2, 0), ('|', 2, 1), ('-', 1, 1), ('|', 1, 2), ('-', 0, 2)]), | |
| (5, [('-', 0, 0), ('|', 0, 1), ('-', 0, 2), ('|', 0, 3), ('-', 0, 4)]), | |
| (6, [('-', 0, 0), ('|', 0, 1), ('-', 0, 2), ('-', 1, 1), ('|', 2, 1)]), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| '''Download the current Spotify Top 50 from Youtube.''' | |
| import urllib.request | |
| import subprocess | |
| # fetch charts | |
| print('Downloading charts...') | |
| req = urllib.request.Request('https://spotifycharts.com/regional/global/weekly/latest/download', headers={'User-Agent': 'Mozilla/5.0'}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Component, OnInit} from '@angular/core'; | |
| import {HttpClient} from "@angular/common/http"; | |
| @Component({ | |
| selector: 'app-root', | |
| template: 'Called API and got: "{{greeting}}"' | |
| }) | |
| export class AppComponent implements OnInit { | |
| public greeting: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ch.kleemans.demoapp; | |
| import org.springframework.web.bind.annotation.CrossOrigin; | |
| import org.springframework.web.bind.annotation.GetMapping; | |
| import org.springframework.web.bind.annotation.RequestParam; | |
| import org.springframework.web.bind.annotation.RestController; | |
| @RestController | |
| public class HelloController { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # install flask | |
| sudo pip3 install flask | |
| # run script | |
| python3 server.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' Simple script for throwing a dice over and over until all numbers appeared at least once. ''' | |
| from __future__ import division | |
| import random | |
| import time | |
| n = 10**5 | |
| r = random.SystemRandom() | |
| def number_of_dice_throws(): | |
| count = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular.module('VociTrainer', ['ngRoute']) | |
| .config(['$routeProvider', '$locationProvider', | |
| function ($routeProvider, $locationProvider) { | |
| $routeProvider | |
| .when('/home', { | |
| templateUrl: 'views/home/home.html', | |
| controller: 'HomeCtrl', | |
| controllerAs: 'home' | |
| }) | |
| .when('/impressum', { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("ExampleController", function () { | |
| var exampleCtrl, $httpBackend, $filter; | |
| beforeEach(module('myapp')); | |
| beforeEach(inject(function ($controller, _$httpBackend_, _$filter_, _Users_) { | |
| $filter = _$filter_; | |
| $httpBackend = _$httpBackend_; | |
| // respond with some mocked data | |
| $httpBackend.whenGET(/...\/users/).respond([{ username: "foo", email: "foo@gmail.com" }, { username: "bar", email: "bar@aol.com" }]); | |
| exampleCtrl = $controller('ExampleController', { Users: _Users_ }); |
NewerOlder