Skip to content

Instantly share code, notes, and snippets.

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

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"
@asw456
asw456 / interviewitems.MD
Created March 29, 2017 10:44 — forked from amaxwell01/interviewitems.MD
My answers to over 100 Google interview questions

##Google Interview Questions: Product Marketing Manager

  • Why do you want to join Google? -- Because I want to create tools for others to learn, for free. I didn't have a lot of money when growing up so I didn't get access to the same books, computers and resources that others had which caused money, I want to help ensure that others can learn on the same playing field regardless of their families wealth status or location.
  • What do you know about Google’s product and technology? -- A lot actually, I am a beta tester for numerous products, I use most of the Google tools such as: Search, Gmaill, Drive, Reader, Calendar, G+, YouTube, Web Master Tools, Keyword tools, Analytics etc.
  • If you are Product Manager for Google’s Adwords, how do you plan to market this?
  • What would you say during an AdWords or AdSense product seminar?
  • Who are Google’s competitors, and how does Google compete with them? -- Google competes on numerous fields: --- Search: Baidu, Bing, Duck Duck Go
@asw456
asw456 / mo_example.java
Last active August 27, 2015 04:30 — forked from rstrickland/mo_example.java
MultipleOutputs Example
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.*;
import org.apache.cassandra.db.IColumn;
import org.apache.cassandra.thrift.*;
import org.apache.cassandra.hadoop.*;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;