Skip to content

Instantly share code, notes, and snippets.

Avatar

Brendan Houng bhoung

View GitHub Profile
@kissgyorgy
kissgyorgy / listen.py
Created Sep 4, 2020
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
View listen.py
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")
View monadstate-example.hs
-- monadstate-example.hs
--
-- Load this program in GHCi:
--
-- stack repl \
-- --resolver nightly \
-- --package transformers \
-- --package mtl \
-- monadstate-example.hs
--
@DmitrySoshnikov
DmitrySoshnikov / GIF-Screencast-OSX.md
Created Jan 30, 2020 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@mkowoods
mkowoods / tmp.sql
Created Jul 9, 2019
Notes for Will Buy on Return visit
View tmp.sql
Source Data Set: https://console.cloud.google.com/bigquery?p=data-to-insights&d=ecommerce&t=web_analytics&page=table
## TRAIN
CREATE OR REPLACE MODEL `ecommerce.classification_model_2`
OPTIONS
(model_type='logistic_reg', labels = ['will_buy_on_return_visit']) AS
WITH all_visitor_stats AS (
View Transform.py
from chalice import Chalice
import boto3
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import pandas as pd
from datetime import datetime
app = Chalice(app_name='Lambda2')
"""On SNS message from Lambda1, tranform data by dropping duplicates
and get sentiment"""
@CMCDragonkai
CMCDragonkai / creating_a_new_stack_project_in_haskell.md
Last active Sep 14, 2021
Creating a new Stack Project in a Nix Shell #haskell
View creating_a_new_stack_project_in_haskell.md

Creating a new Stack Project in a Nix Shell

There are so many different ways of building and maintaining Haskell projects.

I'm going to talk about using nix-shell and stack.

First you want a ~/.stack/config.yaml:

 local-bin-path: /home/USERNAME/.stack/bin
@andrevdm
andrevdm / amazonka_eg.hs
Created Sep 23, 2017
Amazonka: example dynamo & s3
View amazonka_eg.hs
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Protolude hiding (to, (&))
import qualified System.IO as IO
import Control.Lens ((<&>), (^.), (.~), (&), set, view)
import qualified Data.Text as Txt
import qualified Data.Conduit as C
@tgirke
tgirke / _Nvim-R-Tmux.md
Last active Apr 21, 2022
Nvim-R-Tmux: An Integrated Working Environment for R
View _Nvim-R-Tmux.md

Nvim-R-Tmux: Neovim-based IDE for R

!!! This Gist tutorial is deprecated. Its new version is available here !!!

This is some red text.

  • Author: Thomas Girke
  • Last update: 18-Nov-2020

@antirez
antirez / lmdb.tcl
Created Apr 28, 2017
LMDB -- First version of Redis written in Tcl
View lmdb.tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
View Technical Test Instructions.md

WELCOME

We're stoked you've chosen to join us. If you're successful, you'll be joining a team that is focused on technical excellence and continuous improvement. We take great care to produce well-structured, well-tested, maintainable code. To be successful, you'll need to demonstrate that you do as well.

Our expectations are that this exercise should take you no longer than 4 hours to complete (and hopefully much less). If it takes you much longer than that to get to a working solution, you might not be the right candidate for this role.

INSTRUCTIONS

  1. Complete the short version of the Big 5 test and save your results as text.
  2. Create a new git repository for your code.
  3. Write a utility that parses the textual results of your test into the following format. Note that you'll need to include your email, which doesn't appear in the output of your Big 5 test. Feel free to use intermediary data structures and useful libraries.