Skip to content

Instantly share code, notes, and snippets.

View WNiels's full-sized avatar

Niels Westphal WNiels

View GitHub Profile
@janeczku
janeczku / 00-cloud-config.yml
Last active June 10, 2023 15:10
Annotated RancherOS Cloud-init configuration snippets
#cloud-config
# Set the hostname for this machine (takes precedence over hostname assigned by DHCP lease).
hostname: myhost
# Authorize SSH keys for the `rancher` sudoer user
ssh_authorized_keys:
- ssh-rsa AAA...ZZZ example1@rancher
@bradtraversy
bradtraversy / myscript.sh
Last active May 2, 2024 13:59
Basic Shell Scripting
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@adrientetar
adrientetar / btree.py
Last active October 22, 2021 12:33
A simple tree implementation in Python using a list.
"""
A simple btree implementation in Python.
Python 3.3+
"""
class Node:
__slots__ = ['left', 'right', 'value']
@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active April 29, 2024 17:30
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
@mmarcon
mmarcon / CollectionUtils.java
Created September 22, 2013 14:31
Maps are not Parcelable and this is an issue in Android when they need to be passed to activities and services via Intents. The corresponding Map-like object in Android is the Bundle. Bundle is a more generic container, it doesn't enforce types via generics and isn't supported natively by JSON deserializers such as Gson. This utility class expos…
package es.cloudey.pagespeed.util;
import java.util.HashMap;
import java.util.Map;
import android.os.Bundle;
import android.os.Parcelable;
public class CollectionUtils {
public static Bundle toBundle(Map<String, ? extends Parcelable> input) {
@sumanth232
sumanth232 / Suffix_Array.cpp
Created July 10, 2013 12:56
1) Suffix Array construction using - Manber Myers algorithm in O(n log n) time ( O(n) - Karkkainan Sander's algorithm also there ) 2) Linear-Time Longest-Common-Prefix Computation in Suffix
/* By the author :
I'd recommend reading the paper "Linear-Time Longest-Common-Prefix Computation in Suffix Arrays and Its Applications" by Toru Kasai, Gunho Lee, Hiroki Arimura, Setsuo Arikawa, and Kunsoo Park.
It shows how to find the length of the longest common prefixes between consecutive suffixes in lineal time, in around 10 lines of code (really, see code in edit).
I also wanted to share my implementation of Manber & Myers algorithm which is also on edit. I got Accepted on SUBST1 with it. */
// Begins Suffix Arrays implementation
// O(n log n) - Manber and Myers algorithm
// Refer to "Suffix arrays: A new method for on-line string searches",