Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Kafka! 😄

Shawn Seymour devshawn

💻
Kafka! 😄
View GitHub Profile
@Jire
Jire / BadWords.java
Last active Jun 23, 2020
Based off PimDeWitte's, this improves performance by over a magnitude and eliminates all garbage (allocations).
View BadWords.java
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import net.openhft.hashing.LongHashFunction;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
/**
@PimDeWitte
PimDeWitte / Efficient Bad Word Filter
Last active Sep 27, 2021
Simple profanity filter written in Java for efficient comparison. Runtime grows based on string input, not list size.
View Efficient Bad Word Filter
static Map<String, String[]> words = new HashMap<>();
static int largestWordLength = 0;
public static void loadConfigs() {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new URL("https://docs.google.com/spreadsheets/d/1hIEi2YG3ydav1E06Bzf2mQbGZ12kh2fe4ISgLg_UBuM/export?format=csv").openConnection().getInputStream()));
String line = "";
int counter = 0;
while((line = reader.readLine()) != null) {
@seriousme
seriousme / loki-test.js
Created Mar 12, 2015
loki crypted file adapter
View loki-test.js
var cryptedFileAdapter = require('./lokiCryptedFileAdapter');
cryptedFileAdapter.setSecret('mySecret');
var loki=require('lokijs');
var db = new loki('loki.json.crypted',{ adapter: cryptedFileAdapter });
db.loadDatabase({},function(){
var children = db.addCollection('children');
children.insert({name:'Bleep', legs: 2});
db.save();
@elandau
elandau / StateMachine
Created Oct 30, 2014
Rx based state machine
View StateMachine
package com.netflix.experiments.rx;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;
import rx.Observable.OnSubscribe;
@staltz
staltz / introrx.md
Last active Dec 8, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
@sloria
sloria / bobp-python.md
Last active Dec 3, 2021
A "Best of the Best Practices" (BOBP) guide to developing in Python.
View bobp-python.md

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@ThomasChiroux
ThomasChiroux / httpserve.py
Created Sep 26, 2012
python2 and python3 compliant simple http server
View httpserve.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""launch small http server
"""
import sys
try:
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError: