Skip to content

Instantly share code, notes, and snippets.

View chrisking's full-sized avatar

Chris King chrisking

View GitHub Profile
@chrisking
chrisking / ds.py
Created September 17, 2018 12:26
DataScience Help
# First we need a data structure of a datframe with 3 columns ( visitID, landing_page, and converted )
# Then we need to run a probability loop for 10,000 iterations with a 50/50 split getting old or new page, and their respective
# probabilities of converting
# Borrowed this because it worked well
# https://stackoverflow.com/questions/439115/random-decimal-in-python
import decimal
def gen_random_decimal(i,d):
return decimal.Decimal('%d.%d' % (random.randint(0,i),random.randint(0,d)))
@chrisking
chrisking / xor.py
Created September 15, 2018 15:02
XOR test
# First XOR
df2 = df[(df['landing_page'] == "new_page")^(df['group'] == "treatment")]
# Second XOR
df3 = df[(df['landing_page'] == "old_page")^(df['group'] == "control")]
print(pd.merge(df2,df3, indicator=True, how='outer')
.query('_merge=="left_only"')
.drop('_merge', axis=1))
DIR_NAME = "./sorted_cards/"
cards = ['2','3','4','5','6','7','8','9','T','J','Q','K','A']
suits = ['s','c','h','d']
import os
for card in cards:
for suit in suits:
try:
@chrisking
chrisking / helmetfit.conf
Created July 13, 2017 22:27
simple apache file
<VirtualHost *:80>
ServerName www.helmetfit.com
ServerAlias helmetfit.com *.helmetfit.com
DocumentRoot /var/client_sites/helmetfit
<Directory />
Options FollowSymLinks
Require all granted
AllowOverride All
</Directory>
[root@ddc1 netflixbluemix]# cat docker-compose.yml
version: '2'
services:
eureka-server:
build: /root/netflixoss/netflixbluemix-core/eurekaserver/docker
image: dev/spring-eureka-server
expose:
- "8080"
@chrisking
chrisking / Arch_GA.js
Created August 26, 2016 15:34
GA of AC info
Meteor.startup(function($) {
var filetypes = /\.(zip|exe|pdf|doc*|xls*|ppt*|mp3|mp4)$/i;
var baseHref = '';
if (jQuery('base').attr('href') != undefined)
baseHref = jQuery('base').attr('href');
jQuery('a').each(function() {
var href = jQuery(this).attr('href');
if (href && (href.match(/^https?\:/i)) && (!href.match(document.domain))) {
jQuery(this).click(function() {
var extLink = href.replace(/^https?\:\/\//i, '');
➜ ~ traceroute citi.com
traceroute: Warning: citi.com has multiple addresses; using 192.193.218.80
traceroute to citi.com (192.193.218.80), 64 hops max, 52 byte packets
1 dd-wrt (192.168.1.1) 1.846 ms 0.931 ms 1.115 ms
2 * * *
3 cpe-174-111-118-189.triad.res.rr.com (174.111.118.189) 31.001 ms 134.474 ms 23.488 ms
4 cpe-024-025-063-144.ec.res.rr.com (24.25.63.144) 17.777 ms 19.173 ms 9.253 ms
5 24.93.67.202 (24.93.67.202) 16.051 ms 18.790 ms 19.939 ms
6 bu-ether14.atlngamq46w-bcr00.tbone.rr.com (66.109.6.82) 28.287 ms 134.050 ms 26.962 ms
7 0.ae1.pr0.atl20.tbone.rr.com (66.109.6.177) 151.416 ms 21.467 ms 133.254 ms
---
- hosts: all
sudo: true
tasks:
- name: Update Apt's Cache
apt: update_cache=yes
- name: Add Ubuntu Extra Repo Support
apt: name={{ item }} update_cache=yes state=latest
with_items:
@chrisking
chrisking / Vagrantfile
Created May 18, 2016 16:06
ansible via vagrant
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.synced_folder ".", "/home/vagrant/projects/radar"
config.vm.provision :ansible do |ansible|
ansible.playbook = "provision_radar.yml"
end
root@ubuntu:~# ab -n 1000 -c 100 http://acdoctest.mybluemix.net/
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking acdoctest.mybluemix.net (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests