Skip to content

Instantly share code, notes, and snippets.

View ndsh's full-sized avatar
🏴

Julian Hespenheide ndsh

🏴
View GitHub Profile
@sojamo
sojamo / byteArrayToOscMessage.java
Created July 20, 2018 06:32
oscP5, byte array to OscMessage
// oscP5 processing example: byte array to OscMessage
// https://github.com/sojamo/oscp5
// tested with OscP5 0.9.9
import java.util.*;
import oscP5.*;
void setup() {
OscP5 osc = new OscP5(this, 12000);
byte[] b1 = new byte[] {0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x00, 0x2c, 0x73, 0x00, 0x00, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x00, 0x00, 0x00};
#include "color.h"
#include "utilities.h"
#include <math.h>
/*
* Algorithm adapted from https://gist.github.com/hdznrrd/656996. Uses a little libmath.
* */
void color_HSV2RGB(struct color_ColorHSV const *hsv, struct color_ColorRGB *rgb) {
int i;
@Fordi
Fordi / MP3PlayFile.ino
Last active January 19, 2018 13:54
Sample code to play a random MP3 file to the on-board DAC off the root of the on-board SD card on Teensy 3.5/3.6; For use with https://github.com/FrankBoesing/Arduino-Teensy-Codec-lib
#include <Audio.h>
#include <SerialFlash.h>
#include <play_sd_mp3.h>
#define USE_TEENSY3_OPTIMIZED_CODE
// SD-hosted MP3 file source
AudioPlaySdMp3 playMp31;
// Stereo DAC (Teensy 3.5/3.6)
#!/bin/bash
#requirements:
#sha1sum (part of coreutils)
#xxd (part of vim)
#https://github.com/socram8888/ulread
#https://github.com/socram8888/amiitool
#put ulread, ulwrite and amiitool in the same directory as this script
if [ $# -ne 2 ]
@pchhetri
pchhetri / README.md
Last active February 28, 2024 17:26
OS X iMessage (Messages) database merger

OS X iMessage (Messages) database merger

Use it at your own risk! You might end up worse than before. Backup everything beforehand. Twice.

If you have the Messages app setup in multiple Macs with the same Apple ID you may end up with iMessages (or SMS) scattered around all of these Macs. This is because after a certain time the new iMessages (or SMS) recevied will cease to push to devices afer a certain time has elapsed. Thus, if a computer has been offline for some period of time it won't get the new iMessages.

Each Messages instance stores the information in a SQLite database, to consolidate all these databases run the script below. This is where the Messages app stores the SQLite database under ~/Library/Messages, the folder contents will look like as follows:

  • chat.db
@jmpinit
jmpinit / frag.glsl
Created August 8, 2015 18:20
GLSL Bayer dithering shader.
// adapted from http://devlog-martinsh.blogspot.com/2011/03/glsl-8x8-bayer-matrix-dithering.html
uniform sampler2D bgl_RenderedTexture;
uniform sampler2D bayerTexture;
varying vec2 vUv;
float find_closest(float x, float y, float c0) {
float limit = texture2D(bayerTexture, vec2(x / 4.0, y / 4.0)).r;
@teos0009
teos0009 / ESP8266 Arduino Mega.cpp
Last active June 20, 2023 06:25
ESP8266 with Arduino
//#include <SoftwareSerial.h>
//use mega Serial 2 for serial monitor; Serial 1 on pins 19 (RX) and 18 (TX);// Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX).
#define SSID "enter SSID here"
#define PASS "enter password here"
#define DST_IP "220.181.111.85" //baidu.com
//SoftwareSerial dbgSerial(10, 11); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
//serial 2 is to esp8266
@benhuson
benhuson / cust-vimeo-oembed
Last active April 18, 2020 23:30
Customise WordPress Vimeo oEmbed
<?php
/**
* Customise WordPress Vimeo oEmbed
* https://developer.vimeo.com/apis/oembed
*/
function my_oembed_fetch_url( $provider, $url, $args ) {
if ( strpos( $provider, 'vimeo.com' ) !== false) {
@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;
@blixt
blixt / prng.js
Last active January 14, 2024 07:01
A very simple, seedable JavaScript PRNG. NOTE: Please read comments on why this is not a good choice.
// NOTICE 2020-04-18
// Please see the comments below about why this is not a great PRNG.
// Read summary by @bryc here:
// https://github.com/bryc/code/blob/master/jshash/PRNGs.md
// Have a look at js-arbit which uses Alea:
// https://github.com/blixt/js-arbit
/**