Skip to content

Instantly share code, notes, and snippets.

View msurguy's full-sized avatar

Maksim Surguy msurguy

View GitHub Profile
@msurguy
msurguy / multi-key-synth.pde
Created June 26, 2018 18:18
Processing Sketch for synth project
float t = 0;
Circle myCircle;
boolean pressedKeys[] = new boolean [4];
void setup() {
size(600, 600);
pixelDensity(2);
colorMode(HSB, 360, 100, 100);
myCircle = new Circle(width / 2, height / 2, 100, 148);
}
@msurguy
msurguy / readme.md
Last active June 4, 2022 16:28
installing psmoveapi on raspberry pi zero
git clone https://github.com/thp/psmoveapi.git --recursive
sudo apt-get update -y
cd psmoveapi/
mkdir build
cd build
cmake .. -DPSMOVE_BUILD_CSHARP_BINDINGS:BOOL=OFF -DPSMOVE_BUILD_EXAMPLES:BOOL=ON  -DPSMOVE_BUILD_JAVA_BINDINGS:BOOL=OFF -DPSMOVE_BUILD_OPENGL_EXAMPLES:BOOL=OFF -DPSMOVE_BUILD_PROCESSING_BINDINGS:BOOL=OFF -DPSMOVE_BUILD_TESTS:BOOL=OFF -DPSMOVE_BUILD_TRACKER:BOOL=OFF -DPSMOVE_USE_PSEYE:BOOL=OFF
make
sudo cp {psmove.py,_psmove.so} /usr/lib/python3.5
@msurguy
msurguy / d3tosvg.js
Last active December 3, 2017 20:53
save D3 as SVG
const oReq = new XMLHttpRequest();
oReq.open("POST", 'http://localhost:3000/upload', true);
oReq.onload = function (oEvent) {
console.log('uploaded!');
// File was Uploaded ok.
};
// var html = d3.select("svg").node().parentNode.innerHTML;
const svgDoctype = '<?xml version="1.0" standalone="no"?>'
+ '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';
@msurguy
msurguy / gist:ac7304280c88d7409ffe78e63320cfd6
Created November 30, 2017 05:16
Raspberry Pi IP notification
#!/bin/bash
sleep 15
MYIP="$(/bin/hostname --all-ip-addresses)"
curl https://api.pushbullet.com/v2/pushes \
-u <your api token>: \
-d device_iden="<device ID from pushbullet>" \
-d type="note" \
-d title="Pi IP Address" \
-d body=$MYIP \
-X POST
@msurguy
msurguy / osm.py
Created November 29, 2017 23:17 — forked from fogleman/osm.py
AxiDraw + OpenStreetMap
from imposm.parser import OSMParser
from shapely import geometry, ops
import axi
import math
import sys
# put your lat/lng here
LAT, LNG = 0, 0
@msurguy
msurguy / index.html
Created October 26, 2017 04:48 — forked from bellbind/index.html
[html5][devicemotion]live demo of devicemoton event
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>devicemotion event</title>
<script src="script.js"></script>
</head>
<body>
<h1>devicemotion event demo</h1>
<p>
@msurguy
msurguy / main.ino
Last active September 27, 2017 05:45
simple neosegment text
#include "Neosegment.h"
#define SERIAL_BAUD 115200
#define nDigits 6
#define PIN 9
Neosegment neosegment(nDigits, PIN, 100);
uint16_t i, j;
void setup() {
Serial.begin(SERIAL_BAUD);
@msurguy
msurguy / extractPNGs.py
Created August 29, 2017 08:22
Adobe Fusion 360 Python script to extract 360 video frames
#!/usr/bin/python
import argparse
import base64
import os
# This file parses the HTML created by Adobe Fusion 360 Turntable rendering feature and saves the frames as individual PNGs
def parse_html_dump_images(html_file):
for i, line in enumerate(html_file):
@msurguy
msurguy / SevenTest.ino
Created March 10, 2017 19:46 — forked from FredDrago/SevenTest.ino
Arduino demo for seven segment display by PetitStudio
#include <Adafruit_NeoPixel.h>
// Adapted from the Adafruit NeoPixel test example.
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_RGB Pixels are wired for RGB bitstream
// NEO_GRB Pixels are wired for GRB bitstream
// NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels)
@msurguy
msurguy / ESPSockets.ino
Created March 7, 2016 19:37
ESP8266 Websocket + FastLED
/*
When the sketch is uploaded, the ESP8266 will reboot and create its own access point called AutoConnect AP. Connecting to that AP will bring up the
list of available access points. Enter Username and PW for the access point and ESP module will save the credentials for you.
When the module is restarted, it will connect to the AP that you chose and should be available on the network. You can get its IP from the Serial monitor
or use mDNS library (it's uncommented by default, along with all usage of the library) to make the module discoverable.
To change colors on the module (Neopixels on Pin 2), simply go to the root URL of the web server.