Skip to content

Instantly share code, notes, and snippets.

import numpy as np
from collections import deque
import time
import threading
import matplotlib.pyplot as plt
def rollingFFT(s, n, dt):
fy = np.fft.fft(s)
# Frequencies associated with each samples
PRINT 'THE SERVER IS ' + @@SERVERNAME
--select db_name()
PRINT 'THE DATABASE IS ' + db_NAME()
PRINT ''
GO
USE [master]
@asw456
asw456 / flask_logging_requests.py
Created August 26, 2021 00:13 — forked from alexaleluia12/flask_logging_requests.py
Flask Logging (every request)
#/usr/bin/python
# http://exploreflask.com/en/latest/views.html
# https://stackoverflow.com/questions/51691730/flask-middleware-for-specific-route
# https://dev.to/rhymes/logging-flask-requests-with-colors-and-structure--7g1
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
@asw456
asw456 / downloadGists.js
Created June 9, 2013 05:27
download all gists
var request = require('request')
, path = require('path')
, fs = require('fs')
, url = "https://api.github.com/users/thomastraum/gists"
, savepath = './gists';
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {

For anyone who is interested, here's a case study on serialization of scala closures that may or may not have been the result of a lengthy and passionate discussion about what you can and can't serialize and why it's necessary to generate a closure with a generating function if you want to use it in Spark

import java.io.{ByteArrayOutputStream, ObjectOutputStream, NotSerializableException}

object Temp {

  def main(args: Array[String]): Unit = {

    def serialize(value: Any): Array[Byte] = {
@asw456
asw456 / gitflow-breakdown.md
Created December 6, 2018 00:34 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@asw456
asw456 / tf_char_rnn.py
Created March 21, 2018 08:29 — forked from danijar/tf_char_rnn.py
Simple character-level recurrent language model implemented in TensorFlow.
"""Character based language modeling with multi-layer GRUs.
To train the model:
python3 in_graph_char_rnn.py --mode training \
--logdir path/to/logdir --corpus path/to/corpus.txt
To generate text from seed words:
python3 in_graph_char_rnn.py --mode sampling \
@asw456
asw456 / gnn.iris.js
Created November 9, 2017 06:42 — forked from adrianseeley/gnn.iris.js
Code Used To Generate: Neural Genetic Adaptation of the Iris Dataset (GATO-2014)
function gnn (cases, wide, tall, population, iterations, error_fn, error_thresh) {
var inputs = cases[0][0].length;
var outputs = cases[0][1].length;
// declare net, provide input layer
var net = [new Array(inputs)];
// create input neurons in input layer
for (var i = 0; i < inputs; i++)
net[0][i] = {output: 0}
// create hidden layers
for (var x = 0; x < wide; x++) {
@asw456
asw456 / ResNeXt_pytorch.py
Created October 21, 2017 07:27 — forked from mjdietzx/ResNeXt_pytorch.py
pyt🔥rch implementation of ResNeXt
import torch
from torch.autograd import Variable
import torch.nn as nn
class Bottleneck(nn.Module):
cardinality = 32 # the size of the set of transformations
def __init__(self, nb_channels_in, nb_channels, nb_channels_out, stride=1):
super().__init__()
@asw456
asw456 / avazu_ftrl_concurrent.go
Created April 12, 2017 02:49
Kaggle Avazu Challenge: FTRL-Proximal with L1 & L2 implemented in Go (Concurrent/Multi-threaded)
// Based on tinrtgu's Python script here:
// https://www.kaggle.com/c/avazu-ctr-prediction/forums/t/10927/beat-the-benchmark-with-less-than-1mb-of-memory
package main
import (
"encoding/csv"
"os"
"strconv"
"hash/fnv"
"math"