Skip to content

Instantly share code, notes, and snippets.

View MovsisyanM's full-sized avatar
🇦🇲

Movsisyan MovsisyanM

🇦🇲
View GitHub Profile
@MovsisyanM
MovsisyanM / tg_bot_msg_recieve.json
Created December 19, 2021 15:18
Sample telegram bot message recieve
{
"update_id": 99737762,
"message": {
"message_id": 3746,
"from": {
"id": 993903016,
"is_bot": false,
"first_name": "Mher",
"last_name": "Movsisyan",
"username": "Movsisyannn",
@MovsisyanM
MovsisyanM / capped_relu.py
Created May 18, 2022 12:07
Capped ReLU activation function
def capped_relu(x):
"""Mirrored-Z shaped activation function: min(10, relu(x))"""
return tf.minimum(tf.keras.activations.relu(x), 10)
@MovsisyanM
MovsisyanM / Equibatch_Generator.py
Created May 18, 2022 12:10
Balanced generator for 0, 1 binary classification problems
def equigen(
x: pd.DataFrame,
y: pd.Series,
batch_size: int = 256,
seed: int = seed,
preproc: callable = None,
preproc_kwargs: dict = {}):
"""Balanced generator for 0, 1 binary classification problems"""
np.random.seed(seed)
@MovsisyanM
MovsisyanM / GaussSeidel.py
Created May 19, 2022 08:50
Solves the linear system Ax = b using Gauss-Seidel method.
import numpy as np
def Gauss_Seidel(A, b, N):
"""Solves the linear system Ax = b using Gauss-Seidel method."""
x = np.zeros(len(b))
e_inverse = np.linalg.inv(np.tril(A))
for i in range(N):
x += np.dot(e_inverse, b - np.dot(A, x))
@MovsisyanM
MovsisyanM / dp.ipynb
Last active June 1, 2022 11:27
Infinite wait - deepstream-test1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MovsisyanM
MovsisyanM / no_commit_hook.sh
Created April 18, 2024 15:07
No coomit hook from stackoverflow by Mike
#!/bin/bash
#
# This hook will look for code comments marked '//no-commit'
# - case-insensitive
# - dash is optional
# - there may be a space after the //
#
noCommitCount=$(git diff --no-ext-diff --cached | egrep -i --count "(@No|\/\/\s?no[ -]?)commit")
if [ "$noCommitCount" -ne "0" ]; then
echo "WARNING: You are attempting to commit changes which include a 'no-commit'."