Skip to content

Instantly share code, notes, and snippets.

@jjylik
jjylik / Dockerfile
Last active September 15, 2018 09:33
Async profiler container
FROM openjdk:8-jdk-slim
RUN apt-get update && \
apt-get install -y curl && \
apt-get install -y --no-install-recommends linux-perf && \
ln -s /usr/bin/perf_* /usr/bin/perf && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
mkdir /async-profiler && \
curl -L -s https://github.com/jvm-profiling-tools/async-profiler/releases/download/v1.4/async-profiler-1.4-linux-x64.tar.gz | tar xvfz - -C /async-profiler && \
@jjylik
jjylik / README.md
Last active March 18, 2020 13:57
Make me cool example go program

Download and install go

Create a folder for the main.go file

Put main.go there && cd there

go build -o coolmaker

./coolmaker name1 name2

import React from 'react';
import {Icon as ElementsIcon} from 'react-native-elements';
import {IconProps} from 'react-native-elements';
import {GestureResponderEvent} from 'react-native';
import Animated, {
Easing,
block,
cond,
eq,
set,
package main
import (
"fmt"
"image/color"
"log"
"math"
"sort"
"golang.org/x/exp/rand"
@jjylik
jjylik / JsonToMap.java
Created September 8, 2020 05:33
Android JsonReader stream to Map<String, Object>
private Map<String, Object> readObject(JsonReader reader) throws IOException {
Map<String, Object> map = new HashMap<>();
reader.beginObject();
while (reader.hasNext()) {
String name = reader.nextName();
JsonToken token = reader.peek();
if (token == JsonToken.STRING) {
map.put(name, reader.nextString());
} else if (token == JsonToken.NUMBER) {
map.put(name, reader.nextLong());
@jjylik
jjylik / connect-spotify-jack.sh
Last active December 3, 2020 14:36
Zynthian with Spotify and Radio Helsinki players
#!/bin/bash
if [[ "$PLAYER_EVENT" == "start" || "$PLAYER_EVENT" == "playing" ]]; then
service radiohelsinki stop
n=0
until [ "$n" -ge 3 ]
do
jack_connect librespot:out_0 system:playback_1 &>/dev/null
jack_connect librespot:out_1 system:playback_2 &>/dev/null
n=$((n+1))
sleep 3
@jjylik
jjylik / main.go
Created January 29, 2021 14:28
Memory blogpost
package main
import (
"math/rand"
"os"
"time"
)
func main() {
d := time.Now().Local().Add(time.Hour * time.Duration(2)).String()
@jjylik
jjylik / SimpleSineWithDetune.soul
Created February 21, 2021 16:05
SOUL patch with a simple sine synth with LFO detune
/*
== SOUL example code ==
== Author: Jules ==
*/
/// Title: A simple MPE sine-wave synthesiser example
///
/// A simple sine-wave synthesiser featuring pitch-bend support, using a basic
/// envelope and voice-allocator.
@jjylik
jjylik / events.log.json
Last active March 7, 2021 09:06
WAL2JSON output naive go parser
{
"change": [
{
"kind": "update",
"schema": "public",
"table": "users",
"columnnames": ["id", "name"],
"columntypes": ["bigint", "text"],
"columnvalues": [14, "emily"],
"oldkeys": {
@jjylik
jjylik / fetch-content-length.ts
Created March 28, 2021 07:07
Fetch content length
async function fetchContentLength(url: string): Promise<string | null> {
const response = await fetch(url, {method: 'HEAD'});
return response.headers.get('content-length');
}