Skip to content

Instantly share code, notes, and snippets.

View snakers4's full-sized avatar
🚀
It is by will alone I set my mind in motion.

Alexander Veysov snakers4

🚀
It is by will alone I set my mind in motion.
View GitHub Profile
@snakers4
snakers4 / analyzeSocialGraph
Last active January 15, 2017 10:49
DoubleData illustration
SELECT DISTINCT
count (DISTINCT rl.afisha_rest_id) as distinct_rest_count,
count (DISTINCT r2u.afisha_user_id) as review_user_count,
count (DISTINCT r2u.*) as review_count,
count (DISTINCT a2n.social_network_id) as social_network_users,
count (DISTINCT vsoc.social_network_id) as social_graph_data_count
FROM
rest_list rl
import React from 'react';
import {render} from 'react-dom';
import $ from 'jquery';
class ApiConnectors extends React.Component {
constructor (props){
super(props);
this.state = {
apiParams: props.apiParams,
apiUrl: props.apiUrl,
@snakers4
snakers4 / pipeline_calc_v1
Last active March 3, 2017 12:03
Client pipeline example
-- using multiple subqueries to ensure no mistakes
SELECT
average2.weekly as week,
ROUND(AVG(average2.backlog),1) as backlog
FROM
(
SELECT
SUM(average.is_backlog) as backlog,
average.weekly,
average.current_day
def printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'):
"""
Call in a loop to create terminal progress bar
@params:
iteration - Required : current iteration (Int)
total - Required : total iterations (Int)
prefix - Optional : prefix string (Str)
suffix - Optional : suffix string (Str)
decimals - Optional : positive number of decimals in percent complete (Int)
length - Optional : character length of bar (Int)
@snakers4
snakers4 / View_1
Created March 6, 2017 10:08
Ultimate example
SELECT
a.order_id as order_id,
a.creation_time,
a.finalize_time,
a.c_user_id,
a.ug_id,
a.sales_type,
a.payment_type,
a.delivery_date,
a.ag_type_name,
import matplotlib.pyplot as plt
import numpy as np
plt.figure()
languages =['Python', 'SQL', 'Java', 'C++', 'JavaScript']
pos = np.arange(len(languages))
popularity = [56, 39, 34, 34, 29]
# change the bar colors to be less bright blue
# Unsophisticated corr analysis to deal w variable bias
data_corr = sDf.corr()
size = data_corr.shape[0] - 1
# Set the threshold to select only highly correlated attributes
threshold = 0.5
# List of pairs along with correlation above threshold
corr_list = []
# update reps
sudo apt-get update
# installation of the key software
# SOFTWARE
# server monitoring tool
sudo apt-get install glances
# just invoke glances to monitor the system
# FIREWALL
SELECT
TO_JSON(ARRAY_AGG(a))
FROM (
SELECT
raw_data.*,
'http://spark-in.me/post/'||raw_data.slug as disqus_article_url,
(SELECT to_json(array_agg(e)) FROM (
SELECT DISTINCT
at.\"id\" as tag_id,
at.title as tag_title,
.find('[name="articleText"]')
.summernote({
ace: {
aceTheme: 'ace/theme/dawn',
aceMode: 'c_cpp',
aceLineHeight: '32px',
aceFontSize: '16px',
aceModeSelectorLabel: 'select your language',
aceCodeInputAreaLabel: 'input your code',
aceCodeSubmitBtnLabel: 'Insert',