Skip to content

Instantly share code, notes, and snippets.

View popcornell's full-sized avatar
:octocat:

Samuele Cornell popcornell

:octocat:
  • Carnegie Mellon University
  • Pittsburgh
View GitHub Profile
@stevenguh
stevenguh / tcn.py
Created February 7, 2019 05:49
Temporal Conv Net with Non-Causal Conv in PyTorch
# Import TCN library from https://github.com/locuslab/TCN
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import weight_norm
def conv1d_same_padding(input, weight, bias=None, stride=1, dilation=1, groups=1):
input_length = input.size(2)
filter_length = weight.size(2)
@santisbon
santisbon / Search my gists.md
Last active June 11, 2024 02:58
How to search gists.

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@willfurnass
willfurnass / sge_cheatsheet.md
Last active April 19, 2023 15:00
(Son of) Grid Engine tips and tricks

Random Grid Engine tips and tricks

The following work with Son of Grid Engine (SGE) 8.1.9 as configured on the University of Sheffield's ShARC and Iceberg clusters.

Jobs with dependancies

You can use the -hold_jid <<job-name or job-name>> option to make jobs run only when other jobs have finished, rather than having jobs start and sit waiting for other tasks to complete.

@mjdietzx
mjdietzx / residual_network.py
Last active March 26, 2024 06:33
Clean and simple Keras implementation of residual networks (ResNeXt and ResNet) accompanying accompanying Deep Residual Learning: https://blog.waya.ai/deep-residual-learning-9610bb62c355.
"""
Clean and simple Keras implementation of network architectures described in:
- (ResNet-50) [Deep Residual Learning for Image Recognition](https://arxiv.org/pdf/1512.03385.pdf).
- (ResNeXt-50 32x4d) [Aggregated Residual Transformations for Deep Neural Networks](https://arxiv.org/pdf/1611.05431.pdf).
Python 3.
"""
from keras import layers
from keras import models
@hadware
hadware / wav_resample.py
Last active March 6, 2020 11:47
Resampling a wav ndarray with sox in python
import numpy as np
from subprocess import PIPE, run
from scipy.io.wavfile import read, write
## This is in case you have a numpy nd array of your sound, and the sampling rate
## isn't the same as another ndarray. This resamples the array by piping in and out of Sox
## This is a simple example with wav files encoded in float32, with only one channel (mono)
## These parameters can however be adjusted by tweaking -t and -c options in the sox command
with open("sample_48k.wav", "rb") as file_48k, open("sample_16k.wav", "rb") as file_16k:
@asadharis
asadharis / README.md
Last active November 16, 2023 08:40 — forked from dan-blanchard/create_single_machine_sge.md
How to setup a single-machine (Sun) Grid Engine installation for unit tests on Travis-CI

Setting up a SGE cluster on a single Amazon EC2 machine

The gist here provides a script to automate the process of installing Sun Grid Engine (SGE) on a single EC2 machine.

Motivation

SGE is a job scheduler for a computing cluster. This usually involves a cluster of multiple machines. However for many applications we don't need a massive computing cluster and a cluster of 8-30 nodes would be sufficient. In this tutorial we set-up SGE on a single amazon EC2 machine. The reasons for doing so are as follows:

  1. Automation: Setting-up a cluster with SGE is fairly involved as it requires multiple machines communicating with each other and having some shared memory. A single machine with multiple cores is already a simple cluster where the memory is shared across cores.
  2. Moderate Size: Amazon EC2 instances provide a variety of computing options with the number of cores ranging from 1 to 128.
  3. Cost: The On-Demand price structure of AWS makes this a relatively cheap option. Further cost redu
@esromneb
esromneb / g2rref.m
Last active July 21, 2022 12:28
matlab's rref function modified to operate in gf(2)
% This is a modified version of matlab's building rref which calculates
% row-reduced echelon form in gf(2). Useful for linear codes.
% Tolerance was removed because yolo, and because all values
% should only be 0 or 1. @benathon
function [A] = g2rref(A)
%G2RREF Reduced row echelon form in gf(2).
% R = RREF(A) produces the reduced row echelon form of A in gf(2).
%
% Class support for input A:
@dan-blanchard
dan-blanchard / create_single_machine_sge.md
Last active March 20, 2022 10:40
How to setup a single-machine (Sun) Grid Engine installation for unit tests on Travis-CI

I recently needed a way to run unit tests on Travis for a project that uses Sun Grid Engine, Grid Map. Unfortunately, it seemed like no one had figured out how to set that up on Travis before (or simply create a single-machine installation without any user interaction). After hours of trial-and-error, I now know the secrets to making a single-machine installation of SGE that runs on Travis, and I'm sharing my script to prevent other people from going through the same frustrating experience.

To use the install_sge.sh script below, you just need to copy all of the files in this gist to a travis sub-directory directly under the root of your GitHub project, and add the following lines to your .travis.yml

before_install:
  - travis/install_sge.sh
  - export SGE_ROOT=/var/lib/gridengine
  - export SGE_CELL=default
  - export DRMAA_LIBRARY_PATH=/usr/lib/libdrmaa.so.1.0
@aldro61
aldro61 / linear_least_squares.py
Last active August 9, 2021 15:20
A linear least squares solver for python. This function outperforms numpy.linalg.lstsq in terms of computation time and memory.
# Copyright (c) 2013 Alexandre Drouin. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@aluchies
aluchies / zfft.py
Created June 22, 2013 17:22
Zoom FFT functionality. Includes implementation of chirpz transform.
""" Zoom FFT function"""
import numpy as np
from time import time
from scipy.fftpack import fft, ifft
from numpy import swapaxes
def chirpz(x, A=None, W=None, M=None):
"""chirpz(x, A, W, M) - Chirp z-transform of variable x