Skip to content

Instantly share code, notes, and snippets.

@j0uni
j0uni / gist:1bd3f471c0cf9a352b67af4297d8f6ab
Last active April 5, 2025 14:35
OpenAI pull request review Python script
import requests
import openai
import os
from openai import OpenAI
GITHUB_TOKEN = ""
OPENAI_API_KEY = ""
REPO_OWNER = "j0uni"
REPO_NAME = "rtl_icecast"
PULL_REQUEST_ID = 8
@j0uni
j0uni / fix_mysql.php
Created November 1, 2019 16:56
IDIOT-PHP-DEVELOPERS - Fix mysql_connect etc. deprecated (with mysqli_connect and so-on..)
<?php
// include file for php called "IDIOT-PHP-DEVELOPERS"
// this file is a dirty fix to fix deprecated mysql_ - functions.
// first of all, I really don't understand why these functions needed to be deprecated.
// this decision by PHP developer has caused hundreds or thousands work hours to fix
// about this "library" : it might have not all functions so feel free to continue this work
@j0uni
j0uni / gist:1630672c79a9894b2126f361ec4e5588
Created September 3, 2017 07:26
How to get fixed wing aeroplane work with DYS F4 FC work in iNav 1.7.2
How to get fixed wing aeroplane work with DYS F4 FC work in iNav 1.7.2 By default the motor_2 output doesn't support servos.
Use this mixer:
# mixer
mixer CUSTOMAIRPLANE
mmix 0 1.000 0.000 0.000 0.000
# servo
servo 1 700 2300 1400 125 -1
@j0uni
j0uni / Futaba SBUS latency test with Arduino Mega
Last active August 15, 2016 19:19
Futaba SBUS latency test with Arduino Mega
void setup()
{
Serial.begin(115200);
Serial3.begin(100000);
pinMode(13, OUTPUT);
}
uint8_t buffer[255];
uint8_t bufferPos=0;
@j0uni
j0uni / synth.cpp
Created February 25, 2016 11:11 — forked from genericpenguin/synth.cpp
Arduino Synth
/* Arduino Synth from
https://janostman.wordpress.com/2016/01/15/how-to-build-your-very-own-string-synth/
*/
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
// O2 Minipops rhythm box (c) DSP Synthesizers 2016
// Free for non commercial use
// http://janostman.wordpress.com
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
@j0uni
j0uni / gist:50cff9e926d772cecfe4
Last active August 29, 2015 14:24
AS3935 working on Arduino Pro Mini and Embedded Adventures Lightning sensor module on i2c
Using https://github.com/SkyeSweeney/Striker and http://www.embeddedadventures.com/as3935_lightning_sensor_module_mod-1016.html
SREJ = 2
NF_LEV = 2
Gain = 12
WDTH = 2
ISR: Noisy
ISR: Noisy
ISR: Noisy
ISR: Strike
@j0uni
j0uni / gist:b3d8b1e284ed27723cbf
Created April 7, 2015 09:56
OpenSCAD script to make lots of M3 size spacers
module spacer_m3($height)
{
rotate([90,0,0])
difference()
{
cylinder(r=5.5/2, $fn=6, h=$height);
translate([0,0,-$height/2]) cylinder(r=3.2/2, $fn=60, h=$height*2);
}
}
@j0uni
j0uni / gist:7d3d2be9c2f335f96785
Created March 9, 2015 12:29
Atmega 328 sleep
// source: http://forum.arduino.cc/index.php?PHPSESSID=8lp97jhr4smvi9n29he0ii6eu2&topic=78430.msg2080222#msg2080222
//ATmega328P sleep demo
//
//Wire the usual Arduino LED from PB5 (DIP pin 19, Arduino pin 13) to ground, through
//an appropriate current-limiting resistor.
//Wire a tactile button switch from INT0/PD2 (DIP pin 4, Arduino pin 2) to ground.
//
//The sketch will blink the LED three times, then go to sleep.
@j0uni
j0uni / gist:ec7452954d5dd1ee2ea4
Created December 3, 2014 22:03
My pcb-machine.h for Eagle pcb-gcode ULP
//
// For ease of use, and to avoid overwritting your settings,
// use pcb-gcode-setup to make changes to these settings.
//
real DEFAULT_Z_HIGH = 12.700000;
real DEFAULT_Z_UP = 2.540000;
real DEFAULT_Z_DOWN = -0.15;
real DRILL_DEPTH = -2.000000;
real DRILL_DWELL = 1.000000;