Skip to content

Instantly share code, notes, and snippets.

View ybigus's full-sized avatar

Yaroslav Bigus ybigus

View GitHub Profile
@Ely-S
Ely-S / gaussianBlur.ts
Last active March 26, 2024 00:48
Gaussian Blur in Tensorflow.JS
import * as tf from '@tensorflow/tfjs';
import { Tensor3D, Tensor2D, Tensor1D, Tensor4D, Tensor } from '@tensorflow/tfjs';
function get1dGaussianKernel(sigma, size): Tensor1D {
// Generate a 1d gaussian distribution across a range
var x = tf.range(Math.floor(-size / 2) + 1, Math.floor(size / 2) + 1)
x = tf.pow(x, 2)
x = tf.exp(x.div(-2.0 * (sigma * sigma))) as Tensor1D
x = x.div(tf.sum(x))
@ThabetAmer
ThabetAmer / docker-compose.yml
Last active May 28, 2024 00:01
Run SonarQube and SonarScanner in Docker-compose
#
# Based on https://hub.docker.com/_/sonarqube
#
version: "3.7"
services:
sonarqube:
container_name: sonarqube
@blzq
blzq / tf_gaussian_blur.py
Last active October 2, 2023 12:37
TensorFlow (Python) implementation of Gaussian blur of image with variable input kernel size and sigma
def gaussian_blur(img, kernel_size=11, sigma=5):
def gauss_kernel(channels, kernel_size, sigma):
ax = tf.range(-kernel_size // 2 + 1.0, kernel_size // 2 + 1.0)
xx, yy = tf.meshgrid(ax, ax)
kernel = tf.exp(-(xx ** 2 + yy ** 2) / (2.0 * sigma ** 2))
kernel = kernel / tf.reduce_sum(kernel)
kernel = tf.tile(kernel[..., tf.newaxis], [1, 1, channels])
return kernel
gaussian_kernel = gauss_kernel(tf.shape(img)[-1], kernel_size, sigma)
@evancz
evancz / data-interchange.md
Last active April 29, 2024 16:53
Why do I have to write JSON decoders in Elm?

A vision for data interchange in Elm

How do you send information between clients and servers? What format should that information be in? What happens when the server changes the format, but the client has not been updated yet? What happens when the server changes the format, but the database cannot be updated?

These are difficult questions. It is not just about picking a format, but rather picking a format that can evolve as your application evolves.

Literature Review

By now there are many approaches to communicating between client and server. These approaches tend to be known within specific companies and language communities, but the techniques do not cross borders. I will outline JSON, ProtoBuf, and GraphQL here so we can learn from them all.

@DaniSancas
DaniSancas / neo4j_cypher_cheatsheet.md
Created June 14, 2016 23:52
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
@stewartpark
stewartpark / xor.py
Created October 12, 2015 08:17
Simple XOR learning with keras
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.optimizers import SGD
import numpy as np
X = np.array([[0,0],[0,1],[1,0],[1,1]])
y = np.array([[0],[1],[1],[0]])
model = Sequential()
model.add(Dense(8, input_dim=2))