Skip to content

Instantly share code, notes, and snippets.

Maxim Starikov maxistar

Block or report user

Report or block maxistar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:d1bf43ce899c34537e7c3db58f10c01e
* Returns of max profit for the given market values
* it there are not possible to compleat the deal it will return 0
* @param $marketValues the array wit market values, should contain at least one value
* @return int
function getMaxProfit($marketValues) : int
$minValue = $marketValues[array_keys($marketValues)[0]];
View gist:3102bc6063a81d34ed6b
var UI = require('ui');
// Make a list of menu items
var fruits = [
title: "Turn off",
subtitle: "home",
link: ""
View gist:44d1cae665a30fda3d2d
#define DEBOUNCE 10 // button debouncer, how many ms to debounce, 5+ ms is usually plenty
#define LONG_PRESS 2000 //how long to go into setup mode
// here is where we define the buttons that we'll use. button "1" is the first, button "6" is the 6th, etc
int light1_button = 14;
int light1_led = 6;
int light1_on = 0;
int light1_max = 255;
int light1_state = 0; //0 ready
int light1_step = 0; //step to go
View gist:c4d79df27b8435384ee0
ffmpeg -i MVI_7870.MOV -vcodec mpeg4 -s 960x540 -b 1400K -acodec libmp3lame small/MVI_7870.mp4
maxistar / gist:0cec94c4e3b936c6296f
Created Nov 26, 2014
Restoring broken mysql encoding
View gist:0cec94c4e3b936c6296f
mysqldump -h DB_HOST -u DB_USER -p DB_PASSWORD --opt --quote-names \
--skip-set-charset --default-character-set=latin1 DB_NAME > DB_NAME-dump.sql
mysql -h DB_HOST -u DB_USER -p DB_PASSWORD \
--default-character-set=utf8 DB_NAME < DB_NAME-dump.sql
maxistar / gist:8fdd6989560c3a1c7df7
Last active Aug 29, 2015
Configuration for serial binding
View gist:8fdd6989560c3a1c7df7
//add to the beginning of file:
var String ArduinoUpdate = ""
rule "Arduino on update"
Item Arduino received update
ArduinoUpdate = ArduinoUpdate + Arduino.state.toString.trim
println("ArduinoUpdate: " + ArduinoUpdate)
if (ArduinoUpdate.contains(";")) {
View gist:26cb21fe7e045c1200e5
String Arduino "eval arduino" { serial="/dev/ttyUSB0" }
View gist:8428316a68bac289a050
sample to try control led from open hab
// constants won't change. They're used here to
// set pin numbers:
const int switchPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
maxistar / gist:4646d1d4c8d44de5d98f
Created Oct 17, 2014
copy public key to server
View gist:4646d1d4c8d44de5d98f
cat ~/.ssh/ | ssh -i 'cat >> .ssh/authorized_keys'
View gist:04f9e0311b51ca4dcf78
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
You can’t perform that action at this time.