Skip to content

Instantly share code, notes, and snippets.

View arossouw's full-sized avatar

Arno Rossouw arossouw

  • Anonymous
View GitHub Profile
@arossouw
arossouw / clj-scraper
Created June 6, 2019 10:07
core-scraper.clj
(ns scraper.core)
;; params
;; method is either "post" or "get" or any http method
;; url is the url for example 'http://www.example.com'
;; calling the function
;; user=> (http-set-header "post" login_url)
;; {:header {:method "post", :url "http://yourip/#/signin?disableAutoSignin=yes'"}}
(defn http-set-header [method url]
@arossouw
arossouw / df_diff.py
Created May 31, 2019 10:40
Difference between 2 datasets
#!/usr/bin/env python2.7
import pandas as pd
row_1 = [200.3, 150.2]
row_2 = row_1 + [300.4]
df1 = pd.DataFrame(row_1, columns=['credit_amt'])
df2= pd.DataFrame(row_2, columns=['credit_amt'])
column = 'credit_amt'
df2[~df2[column].isin(df1[column])]

>> unix >> Equivalence of VIM and Emacs commands

Equivalence of VIM and Emacs commands

Descriptions for VIM commands are quite straightforward, there is not many choice, you have just to type the command. This is not as simple in Emacs, because there is so much possibilities. Here is presented the Emacs commands and their standard key bindings when there are some. But many (like myself) alter the default keybindings to type faster and according to what they do with Emacs.

This heading includes contributions from David Richfield. Thanks David !

Conventions

WITH RECURSIVE traversed (id, name, path, `left`, `right`) AS (
SELECT id,
name,
CAST(JSON_ARRAY(id) AS JSON),
`left`,
`right`
FROM binary_tree
WHERE id = 1
UNION
SELECT b.id,
WITH RECURSIVE fizz_buzz (sequence, modulo_3, modulo_5) AS (
SELECT 1, CAST('' AS CHAR(4)), CAST('' AS CHAR(5))
UNION ALL
SELECT sequence + 1,
IF(MOD(sequence + 1, 3) = 0, 'Fizz', ''),
IF(MOD(sequence + 1, 5) = 0, 'Buzz', '')
FROM fizz_buzz
WHERE sequence < 100
)
#! /usr/bin/env python3
import string
import sys
import re
from PyQt5.QtCore import QByteArray, QUrl
from PyQt5.QtGui import QFont, QTextDocument
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest
from PyQt5.QtWidgets import *
create or replace function sp_get_winnings(start_date date, end_date date)
returns table(
winnings numeric(12,2),
winning_date date,
bets_won bigint,
slug varchar(255)
) AS
$body$
DECLARE
start_dt_sql text := '''' || $1 || ' 00:00:00';
test
WITH first_deposits AS
(SELECT pt.user_id,
MIN(created_at) AS first_deposit_date
FROM affiliate_customer c,
play_transaction pt
WHERE pt.user_id = c.user_id
AND pt.payment_status = '1'
AND pt.transaction_type = '1'
AND affiliate_id = 350
GROUP BY pt.user_id),
TH first_deposits AS (
SELECT pt.user_id,
MIN(created_at) AS first_deposit_date
FROM affiliate_customer c,
play_transaction pt
WHERE pt.user_id = c.user_id
AND pt.payment_status = '1' AND pt.transaction_type = '1'
AND affiliate_id = 350
GROUP BY pt.user_id
),