Skip to content

Instantly share code, notes, and snippets.

View exelban's full-sized avatar

Serhiy Mytrovtsiy exelban

View GitHub Profile
@exelban
exelban / Geolocation.java
Created March 27, 2020 13:06
Fused Location Provider for Capacitor
package com.getcapacitor.plugin;
import android.Manifest;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Looper;
import com.getcapacitor.JSObject;
import com.getcapacitor.NativePlugin;
import com.getcapacitor.Plugin;
@exelban
exelban / delete_snapshots.sh
Created March 11, 2020 09:38
Script which deletes all snapshots from GCE (google compute engine)
#!/bin/bash
NUMBER=1000
list=""
while read -r line;
do
name=$(echo $line | awk '{print $1;}')
if [ "$name" != "NAME" ]; then
@exelban
exelban / Open vSwitch Raspberry Pi
Last active December 29, 2023 07:06
Open, vswitch, raspberry, pi, Open vSwitch, Raspberry Pi 3
### Download and unarchive openvswitch:
wget http://openvswitch.org/releases/openvswitch-2.5.0.tar.gz
tar -xvzf openvswitch-2.5.0.tar.gz
cd openvswitch-2.5.0
### Install all dependencies:
sudo apt-get install python-simplejson python-qt4 libssl-dev python-twisted-conch automake autoconf gcc uml-utilities libtool build-essential pkg-config
### Build openvswitch:
./configure
@exelban
exelban / simple_tensorflow.py
Created February 25, 2017 21:49
Simple logical function in neural network using tensorflow.
import numpy as np
import tensorflow as tf
x = tf.placeholder("float", [None, 2], name="X")
y = tf.placeholder("float", [None, 1], name="Y")
w = tf.Variable(tf.random_normal([2, 1], stddev=0.01), tf.float32)
b = tf.Variable(tf.random_normal([1]))
linear_model = tf.matmul(x, w) + b
@exelban
exelban / AND_OR_XOR_NOR.py
Created February 22, 2017 19:48
Simple logical function in neural network.
import numpy as np
X_and = np.array([[0,0], [0,1], [1,0], [1,1]])
Y_and = np.array([ [0], [0], [0], [1]])
X_or = np.array([[0, 0], [0,1], [1,0], [1,1]])
Y_or = np.array([ [0], [1], [1], [1]])
X_nor = np.array([[0,0], [0,1], [1,0], [1,1]])
Y_nor = np.array([ [1], [0], [0], [0]])
@exelban
exelban / stream.py
Last active February 14, 2024 05:08
Streaming video from Raspberry Pi camera via WebSockets.
import io
import socket
import struct
import time
import picamera
import argparse
import logging
########################################################################################################################
logging.basicConfig(level=logging.INFO, datefmt='%m/%d/%Y %I:%M:%S %p', format='%(asctime)s - %(name)s - %(message)s')