Skip to content

Instantly share code, notes, and snippets.

View NickShargan's full-sized avatar

Mykola Sharhan NickShargan

  • Canada, Toronto
View GitHub Profile
@ebraraktas
ebraraktas / copy_headers.py
Last active January 4, 2021 10:19
Copy C or C++ include header dependencies recursively
# Example command:
# python copy_headers.py --headers tensorflow/lite/model.h tensorflow/lite/interpreter.h \
# --destination MyAwesomeProject/include
# --include-dirs ../flatbuffers/include # Note that these are relative to --source-dir
# --source-dir ../tensorflow/
import argparse
import os
import subprocess
@arturo182
arturo182 / bom2grouped_csv_jlcpcb.xsl
Last active May 20, 2024 04:57
A KiCad BOM script for generating JLCPCB PCBA-compatible files!
<!--XSL style sheet to convert EESCHEMA XML Partlist Format to grouped CSV BOM Format
Copyright (C) 2014, Wolf Walter.
Copyright (C) 2013, Stefan Helmert.
Copyright (C) 2018, Kicad developers.
Copyright (C) 2019, arturo182.
GPL v2.
Functionality:
Generation of JLCPCB PCBA compatible BOM
@bogdan-kulynych
bogdan-kulynych / install-cuda-10-bionic.sh
Last active December 5, 2023 10:26
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@webhive
webhive / custom_board.h
Last active September 15, 2020 07:08
BLE400 custom board file
#ifndef BLE400_H
#define BLE400_H
// LEDs definitions for BLE400
#define LEDS_NUMBER 5
#define LED_START 18
#define LED_1 18
#define LED_2 19
#define LED_3 20
@akirasosa
akirasosa / mlSpeedTests.swift
Created November 8, 2017 11:37
Benchmark Core ML model in iOS.
import CoreML
import XCTest
@testable import mlsample
class mlsampleTests: XCTestCase {
override func setUp() {
super.setUp()
}
@nieldeokar
nieldeokar / SimpleVibrateDemoActivity.java
Last active September 1, 2023 11:04
Android Vibrate & VibrationEffect class demo Usage
package com.example.nileshdeokar.simplevibratedemo;
import android.os.Build;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
/*
#!/usr/bin/python3
from sys import exit
from sys import stdout
from sys import path as syspath
from os import path as osp
from os import stat, makedirs
import argparse
from shutil import copyfile
@denisb411
denisb411 / plot_mic_fft.py
Created May 3, 2017 12:39
Real time microphone analysis. Real time plot of signal and FFT using numpy, matplotlib and pyaudio
import pyaudio
import numpy as np
import time
import wave
import matplotlib.pyplot as plt
# open stream
FORMAT = pyaudio.paInt16
CHANNELS = 1
@wassname
wassname / dice_loss_for_keras.py
Created September 26, 2016 08:32
dice_loss_for_keras
"""
Here is a dice loss for keras which is smoothed to approximate a linear (L1) loss.
It ranges from 1 to 0 (no error), and returns results similar to binary crossentropy
"""
# define custom loss and metric functions
from keras import backend as K
def dice_coef(y_true, y_pred, smooth=1):
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward