Skip to content

Instantly share code, notes, and snippets.

@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: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:5168414
Created March 15, 2013 08:47
808 #16 camera configuration file + instructions
Date time=[2013/03/15-10:43:16];date time setting,format yyyy/mm/dd hh:mm:ss,
Movie resolution=[0];Movie resolution setting,0:720p 30fps,1:wvga 30fps,2:vga 30fps,
Movie cycle time=[1];movie cycle time,0:5 minutes,1:20 minutes,2:40 minutes,3: 70 minutes,
movie Loop Recording=[0];set loop recording on or off,0:off,1:on,
Movie stamp=[0];set date / time stamp on or off,0:off,1:on,
Movie sound=[2];set movie sound,0:mute,1:level 1,2:level 2,3:level 3,
LED=[0];set LED flicker when recording,0:off,1:on,
Movie quality=[1];set movie quality,set movie data rate,0:10 Mbps,1:7 Mbps,
Power off=[1];set system auto power off time when system pending,0:off,1:30 seconds,2:1 minutes,3:2 minutes,
Movie Flip=[0];set movie rotate,0:off,1:on,
@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:8266528
Created January 5, 2014 10:14
Non-clicky version of the pedalSHIELD sinewave demo (http://www.electrosmash.com/forum/software-pedalshield/6-signal-generator?lang=en) This version uses bitwise AND to get the "rolling" pointer to sinewave table. http://www.electrosmash.com/pedalshield
// Licensed under a Creative Commons Attribution 3.0 Unported License.
// Based on rcarduino.blogspot.com previous work.
// www.electrosmash.com/pedalshield
// sinewave.ino program creates a sinusoidal waveform adjustable in amplitude and frequency.
// potentiometer 0 controls the frequency.
// potentiometer 2 controls the amplitude.
// VERSION HISTORY:
// 5.1.2014 - j0uni : This version uses bitwise AND to get the "rolling" pointer to sinewave table.
@j0uni
j0uni / gist:6873893
Last active December 24, 2015 22:39
Hacking remote controlled power outlet / switch
One-evening hacking for Rev remote controlled power outlet.
The transmitter sends long and short pulses for certain bit length (probably 25 bits).
UPDATD: Oscilloscoped from tx data pin (FOUND THEM!)
(Chan1 off) = 0101110111010100000011000
(Chan1 on) = 0101110111010100000000110
Short pulse=320us
@j0uni
j0uni / gist:6856711
Last active December 24, 2015 20:19
How to build / compile / make CuraEngine on OS X
Steps:
1. You need XCode developer tools (to get g++)
2. Below you can find the Makefile I'm using which on my system works. The paths are nasty hacks, but feel free to modify them..
3. make binary can be found from "/Applications/Xcode.app/Contents/Developer/usr/bin//make"
4. I hacked missing LONG_LONG_MAX by defining it in main.cpp as
#ifndef LONG_LONG_MAX
#define LONG_LONG_MAX LLONG_MAX
#endif
5. Copy compiled binary to "/Applications/Cura/Cura.app/Contents" to make Cura to use it