All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

Login


All New Login
's Avatar

kristofer

Joined 1714567308

Recently created
Least recently created
Recently updated
Least recently updated
All gists 118
kristofer's Avatar

kristofer / String Splitting

0 likes
0 forks
1 files
Last active 1763750838
split a string in both Python and Java

Splitting a String

into a list or array of strings.

Key differences:

  • Python returns a list directly
  • Java returns an array (String[]), which you can convert to List if needed
  • Python uses split() with no argument to split by any whitespace
  • Java requires explicit delimiter - use split("\s+") for any whitespace
kristofer's Avatar

kristofer / Random Integers (Java & Python)

0 likes
0 forks
1 files
Last active 1762530029
easy way to generate a random int from to max

If you need to generate a random integer, a number from say, 1 to 6, you can write a couple routines:

Java

import java.util.Random;

int min = 1;
int max = 6;
kristofer's Avatar

kristofer / Pandas Hello World

0 likes
0 forks
2 files
Last active 1753283286
a very simple pandas test

Explanation:

import pandas as pd:

This line imports the pandas library, aliasing it as pd for convenience, which is a common convention.

data = {'Message': ['Hello, World!']}:
kristofer's Avatar

kristofer / Spark/Docker Troubleshooting Guide

0 likes
0 forks
1 files
Last active 1751371779

Spark-Docker-SQL - Troubleshooting Guide

🚨 Quick Emergency Fixes

🔥 "Everything is Broken" - Nuclear Option

# Stop everything and restart fresh
docker-compose down -v --remove-orphans
docker system prune -f
docker volume prune -f
kristofer's Avatar

kristofer / Create Classroom assignment

0 likes
0 forks
1 files
Last active 1750972057
for GitHub classroom
1 #!/bin/bash
2
3 # GitHub Classroom Assignment Creator
4 # This script creates a new assignment in a GitHub Classroom using the GitHub CLI
5
6 set -e # Exit on any error
7
8 # Color codes for output
9 RED='\033[0;31m'
10 GREEN='\033[0;32m'
kristofer's Avatar

kristofer / millions.java

0 likes
0 forks
3 files
Last active 1750425725
experimentation in code is Good Idea
1 import java.time.Duration;
2 import java.time.Instant;
3 import java.util.ArrayList;
4
5 public class Millions {
6
7
8 private Integer[] aArray;
9 private ArrayList<Integer> aList;
kristofer's Avatar

kristofer / HTTP Server Java

0 likes
0 forks
2 files
Last active 1750422453
a very simple HTTP server in Java
1 package rocks.zipcode;
2
3 import java.io.IOException;
4 import java.io.OutputStream;
5 import java.net.InetSocketAddress;
6
7 import com.sun.net.httpserver.HttpExchange;
8 import com.sun.net.httpserver.HttpHandler;
9 import com.sun.net.httpserver.HttpServer;
kristofer's Avatar

kristofer / DTOs (java & python)

0 likes
0 forks
2 files
Last active 1749231863
Data Transfer Objects (DTOs) Explained for Beginners (Java, then Python)

Data Transfer Objects (DTOs) via Java; Explained for Beginners

What Are DTOs?

A Data Transfer Object (DTO) is a simple container for data that travels between different parts of your application. Think of a DTO like an envelope specifically designed to carry exactly what's needed—no more, no less.

public class OrderDTO {
    private Long id;
    private String customerName;
kristofer's Avatar

kristofer / Newbie and Git

0 likes
0 forks
1 files
Last active 1747851336
How to SSH keys etc and so for Newbies and Git

Adding a new SSH key to your GitHub account

As a newbie, you don't understand this, but...

when you're in a terminal and you're fussing with git and you push and oops it doesn't work.

Maybe you need to make sure your git account has keys on your Mac so that git push works right.

To configure your account on GitHub.com to use your new (or existing) SSH key, you'll also need to add the key to your account.

kristofer's Avatar

kristofer / Maven for Java Newbies

0 likes
0 forks
1 files
Last active 1747849974

Maven and POM.xml for Newbie Java Programmers

What is Maven?

Maven is a powerful build automation and project management tool primarily used for Java projects. Think of it as your project's organizer and assistant that handles several critical tasks:

  • Dependency Management: Automatically downloads and manages libraries your project needs
  • Project Building: Compiles your code, runs tests, and packages your application
  • Project Structure: Enforces a standard directory layout for consistent organization
Newer Older

Powered by Opengist ⋅ Load: 180ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano Português Русский Türkçe Українська 中文 繁體中文