Skip to content

Instantly share code, notes, and snippets.

View jnsdbr's full-sized avatar
👀
Whats up?

Jens jnsdbr

👀
Whats up?
View GitHub Profile
@jnsdbr
jnsdbr / convert_web_log.py
Last active September 7, 2022 09:25
Convert dream_web_log.txt generated by https://github.com/lstein/stable-diffusion webinterface to json
import glob
import json
import os
output_path = './outputs/img-samples/'
log_file_name = 'dream_web_log.txt'
full_log_path = output_path + log_file_name
image_list = glob.glob(output_path + '*.png')
def convert_log_to_json(log_file_path):
public class Palette
{
public int[] colors;
public int colorCount;
public String title;
public Palette(int[] colors, String title)
{
this.colors = colors;
this.colorCount = colors.length;
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char* ssid = "...";
const char* password = "...";
const char* mqtt_server = "...";
WiFiClient espClient;
PubSubClient client(espClient);
@jnsdbr
jnsdbr / atcommand.ino
Created January 7, 2017 19:13
ATCommands for the HC05 Bluetooth breakouts
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
/**
* TX -> 10
* RX -> 11
* KEY -> 6
*
* Set baudrate in Serial monitor to 38400!!!
* Connect Module after arduino is started!
@jnsdbr
jnsdbr / hs-785hb.ino
Last active January 5, 2017 13:58
Test sketch for the Hitec HS-785HB
// zoomkat 12-25-13 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// Send an a to attach servo or d to detach servo
// for IDE 1.0.5 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.
#include <Servo.h>
String readString; //String captured from serial port
@jnsdbr
jnsdbr / ofApp.cpp
Created January 29, 2016 10:13
ofx DirectionalLight example
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofSetVerticalSync(true);
ofBackground(255);
ofSetSmoothLighting(true);
// Box size
box.set(100);
// Bounce.pde
// -*- mode: C++ -*-
//
// Make a single stepper bounce from one limit to another
//
// Copyright (C) 2012 Mike McCauley
// $Id: Random.pde,v 1.1 2011/01/05 01:51:01 mikem Exp mikem $
#include <AccelStepper.h>
@jnsdbr
jnsdbr / particle-cli.md
Last active October 6, 2015 17:54
particle-cli installation after updating osx to 10.11

Xcode command line tools

xcode-select --install

Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Fancy stuff no one needs to know...

sudo npm install -g n
sudo n 0.10.36```
@jnsdbr
jnsdbr / gsap_slider.html
Created September 17, 2015 15:14
Simple Slider using GSAP
<html>
<head>
<title>Slider test</title>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
box-sizing: border-box;
font-family: 'Roboto';
import java.awt.event.*;
import java.awt.Robot;
Robot bot = null;
int nextClick = (int)random(15, 50);
void setup() {
try {
bot = new Robot();
}