Skip to content

Instantly share code, notes, and snippets.

View AhmadMoussa's full-sized avatar
🔮
Hello, is this Turing?

Ahmad Moussa AhmadMoussa

🔮
Hello, is this Turing?
View GitHub Profile
@AhmadMoussa
AhmadMoussa / PaddingCalculator.py
Created December 8, 2019 07:49
Calculate padding of Conv1D and ConvTranspose1D in pytorch
import math
def calculatePadding(L, KSZ, S, D, deconv = False):
'''
:param L: Input length (or width)
:param KSZ: Kernel size (or width)
:param S: Stride
:param D: Dilation Factor
:return: Returns padding such that output width is exactly half of input width
'''
import pandas as pd
file_path = 'path_to_your.csv'
if(file_path[-4:] == '.csv'):
df = pd.read_csv(file_path, sep=';')
df.to_excel (file_path[:-4] + '.xlsx', index = None, header=True)
file_path = file_path[:-4] + '.xlsx'
sheet = pd.read_excel(file_path, sheet_name='Sheet1')
I am attesting that this GitHub handle AhmadMoussa is linked to the Tezos account tz1hXx6tvTV3kzxpBR6E4hDYcxdgcRGHUTFj for tzprofiles
sig:edsigtfS27ix8oe7qtCWtw7X3yPUfFFbcVn9eYXZoaxfv4aMfY6wh1BQaeWVZLsm5UqetiZVhKyJdeQ4x1CAn4XLbfW5jsxty4f
var listOfColors = ["#1c77c3","#39a9db","#40bcd8","#f39237","#d63230","#540d6e","#ee4266","#ffd23f","#f3fcf0","#1f271b"];
["#540d6e","#ee4266","#ffd23f","#f3fcf0","#1f271b"]
class Orbiter{
constructor(cx,cy){
this.centerX = cx
this.centerY = cy
this.positionX = 0
this.positionY = 0
// Where is the circle
let x, y;
let num_circles = 150;
let circles = [];
class Circle {
constructor() {
this.x = random(0, width)
this.y = random(0, height)
this.diameter = random(10, 30);
var listOfColors = ["#1c77c3", "#39a9db", "#40bcd8", "#f39237", "#d63230", "#540d6e", "#ee4266", "#ffd23f", "#f3fcf0", "#1f271b"];
["#540d6e", "#ee4266", "#ffd23f", "#f3fcf0", "#1f271b"]
class Orbiter {
constructor(cx, cy) {
this.centerX = cx
this.centerY = cy
this.positionX = 0
this.positionY = 0
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
float rectshape(vec2 position, vec2 scale){
scale = vec2(0.5) - scale * 0.5;
vec2 shaper = vec2(step(scale.x, position.x), step(scale.y, position.y));
import librosa
import threading
import numpy as np
import os
num_splits = 8
data_path = "ProcessedNumpys"
dataset = []
def add_to_arr(i, data_path, filenames, start, end):
@AhmadMoussa
AhmadMoussa / PyTorchUNet.py
Last active March 20, 2020 19:25
Minimal Code to create a scalable UNet in PyTorch.
import torch
from torch import nn
def convBlock(inc, outc, ksz, conv_or_deconv):
return nn.Sequential(
nn.Conv2d(in_channels=inc, out_channels=outc, kernel_size=ksz,
stride=2) if conv_or_deconv else nn.ConvTranspose2d(in_channels=inc, out_channels=outc,
kernel_size=ksz, stride=2),
nn.LeakyReLU(),
nn.BatchNorm2d(num_features=outc)
# ffmpeg -i filenameee.m4a -acodec libmp3lame -ab 256k output.mp3