Skip to content

Instantly share code, notes, and snippets.

View melanj's full-sized avatar

Melan Jayasinghage melanj

View GitHub Profile
@melanj
melanj / ANSI.md
Created September 6, 2025 06:25 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.stream.Stream;
public class DeleteOldFiles {
public static void main(String[] args) throws IOException {
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import java.io.*;
import java.nio.file.*;
import java.util.List;
public class RecordExporter {
private final SqlSessionFactory sqlSessionFactory;
@melanj
melanj / DummyUserDetailsService.java
Created December 3, 2023 15:05 — forked from tobecwb/DummyUserDetailsService.java
Kerberos Login with Spring Boot
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
public class DummyUserDetailsService implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
#! /bin/bash -x
if [ ! -d autoconf-2.71/root/bin ] ; then
wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz
tar -xf autoconf-2.71.tar.xz
pushd autoconf-2.71
./configure --prefix=`pwd`/root
make && make install
popd
fi
@melanj
melanj / Dockerfile
Created November 13, 2022 01:39 — forked from christianberg/Dockerfile
Sharing a unix socket between a Docker container and it's host
FROM ubuntu
RUN apt-get update
RUN apt-get install -y socat
VOLUME /foo
CMD socat UNIX-LISTEN:/foo/bar.sock -
// ...
} else if(room == 10){
System.out.print("You are in the north ce");
if(hasKey){
System.out.println("There is nothing");
} else {
System.out.println("There is somethin");
}
} else if(room == 11){
System.out.println("The door to the first");
public class Traveler
{
public int age;
public String fullName;
private String Country;
private Traveler(int age, String fullName, String country)
{
this.age = age;
this.fullName = fullName;
@melanj
melanj / README.md
Created October 1, 2021 17:38 — forked from Anubisss/README.md
How to compile statically linked OpenVPN client for ARMv5

How to compile statically linked OpenVPN client for ARMv5

You need to install ARMv5 gcc cross compiler: apt-get install gcc-arm-linux-gnueabi

You have to define a directory (via --prefix) where all of your binaries will be installed (copied). In the guide I use the following: /home/user/vpn_compile

OpenSSL

  1. Download the source: wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz
@melanj
melanj / .block
Created May 17, 2020 07:08 — forked from NPashaP/.block
US State Map
license: gpl-3.0