Skip to content

Instantly share code, notes, and snippets.

View kalaspuffar's full-sized avatar
💭
Even penguins can fly when it blows enough

Daniel Persson kalaspuffar

💭
Even penguins can fly when it blows enough
View GitHub Profile
def _load_simple_annotation(self, index):
"""
Load image and bounding boxes info from txt space separeted values where you have
lines in the format of
classification x1 y1 x2 y2
"""
filename = os.path.join(self._data_path, 'Annotations', index + '.txt')
# print 'Loading: {}'.format(filename)
with open(filename) as f:
@kalaspuffar
kalaspuffar / CollectionPerformanceTest.java
Created April 6, 2018 20:17
Simple example of performance testing for collection types in java
package org.ea.debugger;
import java.lang.management.ManagementFactory;
import java.util.*;
import java.util.function.IntConsumer;
public class CollectionTest {
public static void sleep() {
try {
Thread.sleep(3000);
Methods
1. Creation of a webapp for interactive communication
2. Weekly report form (Template)
3. Modify an existing app
4. Biannual reports
Solutions
1. Creation of awareness, incentives and settings and clear targets
2. Bridging the power gap - non formal communication
3. Weekly briefs and summary - improve quality and simplify reports
import re
addrs = [
'PetImages/A/test1.jpg',
'PetImages/B/test3.jpg',
'PetImages/B/test3.jpg',
'PetImages/C/test4.jpg',
'PetImages/D/test2.jpg',
'PetImages/C/test4.jpg',
'PetImages/A/test1.jpg',
@kalaspuffar
kalaspuffar / create_k3s_cluster.md
Last active April 8, 2023 15:14
Simple description how to create a k3s cluster.

Creating a small K3S cluster.

First ensure that you have curl installed the nodes and server so you can install the packages for k3s.

First run the command below in order to create a control node, a server that all your other nodes will connect to in order to get their commands from.

curl -sfL https://get.k3s.io | sh -

Next up we need to setup the nodes. And in order to set this up we need some information. Run the commands below on the server to fetch the internal IP address of the network with the controller and nodes. We also need a security token from the server which we can fetch with cat.

import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import sun.net.httpserver.HttpServerImpl;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
package org.ea;
import java.security.MessageDigest;
import java.util.Arrays;
public class FeistelAlg {
private final static String plainText = "the brown fox jumped over the lazy dog";
public static void doRound(byte[] left, byte[] right) throws Exception {
MessageDigest md = MessageDigest.getInstance("sha-1");
Download and extract the LJ Speech dataset
Clone this repo: git clone https://github.com/NVIDIA/tacotron2.git
CD into this repo: cd tacotron2
Initialize submodule: git submodule init; git submodule update
Update .wav paths: sed -i -- 's,DUMMY,ljs_dataset_folder/wavs,g' filelists/*.txt

Upgrade from Debian Jessie to Buster

First of we ensure that the current installation is as upgraded as possible and that all the packages in the systems have the lastest version without showing any errors or broken packages.

apt update
apt upgrade -y

These commands will verify the package installation and show any issues with the current installation.

Working with docker and registry

First of we install the docker client, server and registry on our debian machine.

apt install docker docker.io docker-registry

The registry could be installed as a service in our docker cloud as well.

docker run -d -p 5000:5000 --restart=always --name registry registry:2