Skip to content

Instantly share code, notes, and snippets.

View szolotykh's full-sized avatar
😀

Sergey Zolotykh szolotykh

😀
View GitHub Profile
@szolotykh
szolotykh / CString.cpp
Created June 28, 2019 23:57
CString Split C++
#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include "cstring.h"
using namespace std;
void CString::split(std::vector<CString>& strings)
@szolotykh
szolotykh / FT232H_GPIO.cpp
Created March 12, 2019 02:26
FT232H GPOI example (Windows)
#include <windows.h>
#include <iostream>
#include <chrono>
#include <thread>
#include "libMPSSE_i2c.h"
using namespace std;
@szolotykh
szolotykh / Check.cpp
Created September 19, 2015 02:56
Check.cpp
#include <iostream>
#include <functional>
class P
{
public:
std::function<void(int)> check = [this](int a)
{
std::cout << "Check 1: " << a << "\n";
check = [this](int a)
@szolotykh
szolotykh / AStar.py
Last active February 25, 2020 19:07
Implementation A* in python
def AStar(problem):
closedset = list()
openset = list()
came_from = dict()
g_score = dict()
f_score = dict()
goal = problem.getGoal()
start = problem.getStart()
g_score[start] = 0
@szolotykh
szolotykh / twitter-stream.py
Created January 29, 2015 16:55
Script streams posts from twitter with tweepy
import tweepy
import os
import json
# Consumer keys and access tokens, used for OAuth
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
@szolotykh
szolotykh / twitter-post.py
Created January 29, 2015 16:52
Script post on twitter message and image with tweepy
import tweepy
import os
# Consumer keys and access tokens, used for OAuth
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
# OAuth process, using the keys and tokens
@szolotykh
szolotykh / speech2text.html
Created January 22, 2015 23:17
HTML5 Speech to text example
<html>
<head>
<script>
var recognition = new webkitSpeechRecognition();
recognition.continuous = true;
//recognition.interimResults = true;
function start(){
recognition.onresult = function(event) {
console.log(event);
var output = document.getElementById("output");
@szolotykh
szolotykh / FullScreenTest.html
Created January 7, 2015 20:57
Web page (div) fullscreen mode
<html>
<head>
<script>
function goFullScreen(elem){
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
@szolotykh
szolotykh / JSCameraTest.html
Created December 26, 2014 16:09
HTML5 Camera test
<html>
<script>
var errorCallback = function(e) {
console.log('Rejected', e);
};
function init(){
navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
@szolotykh
szolotykh / LegoNXTSerial.js
Created December 22, 2014 16:27
Send tone command to Lego NXT
var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("COM4", {
baudrate: 9600
});
serialPort.on("open", function () {
console.log('open');
serialPort.on('data', function(data) {