Skip to content

Instantly share code, notes, and snippets.

View ahlusar1989's full-sized avatar
🏀
Let's Go!

Saran Ahluwalia ahlusar1989

🏀
Let's Go!
View GitHub Profile
@soxofaan
soxofaan / README.md
Last active January 19, 2024 17:48
Simple pretty CSV and TSV file viewer.
@mbejger
mbejger / snr-periodic.py
Created October 13, 2016 07:57
Matched filter and signal-to-noise for a periodic template
"""
Plot white noise with added sinusoidal signal
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
import h5py
fs = 4096 # sampling rate [Hz]
T = 4 # duration [s]
@valentina-s
valentina-s / jupyter-google-cloud.md
Created October 10, 2016 01:53
Jupyter Notebook on Google Cloud Compute Instance

On Instance:

pip install jupyter[notebook]

jupyter notebook --generate-config

# nano .jupyter/jupyter_notebook_config.py

echo "c = get_config()
c.NotebookApp.ip = '*'
@sadikovi
sadikovi / LRUCache.scala
Created September 27, 2016 08:59
LRU cache using linked list (super-hacky implementation)
import java.util.HashMap
class Node[K, V](var key: K, var value: V) {
var next: Node[K, V] = null
override def toString(): String = s"Node($key, $value) -> $next"
}
class LRUCache[K, V](val size: Int = 5) {
require(size > 0, s"Expected size > 0, found $size")
val map = new HashMap[K, Node[K, V]]()
@dmeents
dmeents / navigation.js
Created July 19, 2016 00:44
The complete source code for the Creating a collapsible navigation menu in react
import React, { Component } from 'react';
import { Link } from 'react-router';
import classNames from 'classnames';
import MobileNav from 'react-icons/lib/io/navicon-round';
//navigation display
export default class NavContainer extends Component {
constructor(props) {
super(props);
this.state = {
[
{
"title": "How to handle state in React. The missing FAQ.",
"author": "Osmel Mora",
"url": "https://medium.com/react-ecosystem/how-to-handle-state-in-react-6f2d3cd73a0c"
},
{
"title": "You might not need React Router",
"author": "Konstantin Tarkus",
"url": "https://medium.freecodecamp.com/you-might-not-need-react-router-38673620f3d"
import unittest
def foo(x, y, z):
return (x != y and x != z or x and z)
def get_test_args():
x = y = z = [True, False]
from itertools import product, repeat
# for each input arg ---> expected arg
input_args = list(product(x, y, z))
@mesgarpour
mesgarpour / YeoJohnson.py
Last active October 13, 2022 11:53
Yeo-Johnson Transformation
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import warnings
import numpy as np
import pandas as pd
import sys
__author__ = "Mohsen Mesgarpour"
__copyright__ = "Copyright 2016, https://github.com/mesgarpour"
__credits__ = ["Mohsen Mesgarpour"]
@ahlusar1989
ahlusar1989 / stateMock.js
Created May 22, 2016 23:17 — forked from wilsonwc/stateMock.js
Angular Mock for properly resolving ui-router $state in Karma unit tests
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@erikbern
erikbern / use_pfx_with_requests.py
Last active May 1, 2024 11:45
How to use a .pfx file with Python requests – also works with .p12 files
import contextlib
import OpenSSL.crypto
import os
import requests
import ssl
import tempfile
@contextlib.contextmanager
def pfx_to_pem(pfx_path, pfx_password):
''' Decrypts the .pfx file to be used with requests. '''