Skip to content

Instantly share code, notes, and snippets.

View jhoffmann99's full-sized avatar

Jürgen jhoffmann99

  • Munich
View GitHub Profile
@jhoffmann99
jhoffmann99 / web-servers.md
Created October 11, 2022 17:35 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@jhoffmann99
jhoffmann99 / java-string-format-regex.java
Created September 30, 2022 13:38
format string to match regex
import java.util.*;
import java.util.stream.Collectors;
class Main {
public static void main(String args[]) {
int[] numbers = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
String numberString = Arrays.stream(numbers).mapToObj(String::valueOf).collect(Collectors.joining("")).replaceFirst("(\\d{3})(\\d{3})(\\d{4})", "($1) $2-$3");
System.out.println(numberString); // => (123) 456-7890
// even shorter
@jhoffmann99
jhoffmann99 / GitCommitEmoji.md
Created June 10, 2022 05:25 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji