Skip to content

Instantly share code, notes, and snippets.

View timvw's full-sized avatar

Tim Van Wassenhove timvw

View GitHub Profile
@justinmklam
justinmklam / python-paths-and-imports.md
Last active May 7, 2024 21:05
Techniques for python path manipulation and relative imports in (i.e. when not dealing with a package).

Paths

import os

# To get the directory of the script/file:
current_dir = os.path.dirname(os.path.realpath(__file__))

# To get one directory up from the current file
parent_dir = os.path.abspath(os.path.join(current_dir, ".."))
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active October 15, 2025 08:31
Conventional Commits Cheatsheet
case class SessionInfo(sessionStartTimestampMs: Long,
sessionEndTimestampMs: Long,
numEvents: Int) {
/** Duration of the session, between the first and last events + session gap */
def durationMs: Long = sessionEndTimestampMs - sessionStartTimestampMs
}
case class SessionUpdate(id: String,
sessionStartTimestampSecs: Long,
@HeartSaVioR
HeartSaVioR / EventTimeSessionWindowImplementationViaFlatMapGroupsWithState.scala
Last active November 15, 2020 09:15
Implementation of session window with event time and watermark via flatMapGroupsWithState, and SPARK-10816
case class SessionInfo(sessionStartTimestampMs: Long,
sessionEndTimestampMs: Long,
numEvents: Int) {
/** Duration of the session, between the first and last events + session gap */
def durationMs: Long = sessionEndTimestampMs - sessionStartTimestampMs
}
case class SessionUpdate(id: String,
sessionStartTimestampSecs: Long,
@HeartSaVioR
HeartSaVioR / ClassInvestigator.java
Created October 1, 2018 04:11
Tiny class to investigate why NoSuchMethodException occurs on your classpath
package net.heartsavior;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class ClassInvestigator {
public static void main(String[] args) {
if (args.length < 1) {
@w00dbury
w00dbury / NYC Taxi Data
Last active April 29, 2022 18:52
Download NYC taxi data
aws s3 sync s3://nyc-tlc . --no-sign-request --exclude "*" --include "trip data*"
@itzg
itzg / KafkaStreamsConfig.java
Created August 24, 2018 14:09
Example of configuring Kafka Streams within a Spring Boot application with an example of SSL configuration
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsBuilder;
import org.apache.kafka.streams.StreamsConfig;
import org.apache.kafka.streams.Topology;
import org.apache.kafka.streams.kstream.GlobalKTable;
import org.apache.kafka.streams.kstream.KStream;
import org.apache.kafka.streams.kstream.Materialized;
@mrthomaskim
mrthomaskim / install-Python-AmazonLinux-20171023.log
Created June 13, 2018 20:44
Amazon Linux AMI, pyenv, virtualenv, Python, ... Hello, World!
### prerequisites
sudo yum groupinstall "Development Tools"
git --version
gcc --version
bash --version
python --version # (system)
sudo yum install -y openssl-devel readline-devel zlib-devel
sudo yum update
### install `pyenv`
@hryniuk
hryniuk / pre-commit-cargo-fmt
Last active February 7, 2024 09:21
Git `pre-commit` hook that checks Rust code style with `cargo fmt`
#!/bin/bash
diff=$(cargo fmt -- --check)
result=$?
if [[ ${result} -ne 0 ]] ; then
cat <<\EOF
There are some code style issues, run `cargo fmt` first.
EOF
exit 1
@fullpipe
fullpipe / android_instructions.md
Last active December 10, 2017 20:03 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"