Skip to content

Instantly share code, notes, and snippets.

View AbhishekAshokDubey's full-sized avatar

Abhishek Dubey AbhishekAshokDubey

View GitHub Profile
@brentp
brentp / linear_model.py
Created April 10, 2013 15:57
calculate t statistics and p-values for coefficients in Linear Model in python, using scikit-learn framework.
from sklearn import linear_model
from scipy import stats
import numpy as np
class LinearRegression(linear_model.LinearRegression):
"""
LinearRegression class after sklearn's, but calculate t-statistics
and p-values for model coefficients (betas).
Additional attributes available after .fit()
@sloria
sloria / recorder.py
Last active April 12, 2024 11:43
WAV recording functionality using pyaudio
# -*- coding: utf-8 -*-
'''recorder.py
Provides WAV recording functionality via two approaches:
Blocking mode (record for a set duration):
>>> rec = Recorder(channels=2)
>>> with rec.open('blocking.wav', 'wb') as recfile:
... recfile.record(duration=5.0)
Non-blocking mode (start and stop recording):
@GrahamDumpleton
GrahamDumpleton / gist:b79d336569054882679e
Last active January 10, 2020 22:05
Running HTTPS and client authentication with mod_wsgi-express.

Note that for client authentication the very latest mod_wsgi-express version is required.

For now this means installing from from the git repo. To install run:

pip install -U https://github.com/GrahamDumpleton/mod_wsgi/archive/develop.zip

To create a self signed server certificate so that can run HTTPS use:

@samuelsmal
samuelsmal / pyspark_udf_filtering.py
Created October 11, 2016 14:10
PySpark DataFrame filtering using a UDF and Regex
from pyspark.sql.functions import udf
from pyspark.sql.types import BooleanType
def regex_filter(x):
regexs = ['.*ALLYOURBASEBELONGTOUS.*']
if x and x.strip():
for r in regexs:
if re.match(r, x, re.IGNORECASE):
return True
@mentlsve
mentlsve / scrooge-coin-main.java
Last active May 27, 2021 05:40
Coursera - Programming Assignment: Scrooge Coin - Simple Main Class
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import java.math.BigInteger;
import java.security.*;
public class Main {
public static void main(String[] args) throws NoSuchProviderException, NoSuchAlgorithmException, InvalidKeyException, SignatureException {
// Crypto setup