Skip to content

Instantly share code, notes, and snippets.

@bellowsj
bellowsj / calling_stubhub_api.py
Created February 11, 2025 18:50 — forked from ozzieliu/calling_stubhub_api.py
Proof of Concept task to get ticket prices and event info using StubHub's API with Python
# Quick intro to accessing Stubhub API with Python
# Ozzie Liu (ozzie@ozzieliu.com)
# Related blog post: http://ozzieliu.com/2016/06/21/scraping-ticket-data-with-stubhub-api/
# Updated 3/5/2017 for Python 3 and Stubhub's InventorySearchAPI - v2
import requests
import base64
import json
import pprint
import pandas as pd
@nwlodychak
nwlodychak / perm_test.py
Created February 11, 2025 18:49
Permutation Test in python
observed_variance = df.groupby('Group').mean().var()[0]
print('Observed means:', df.groupby('Group').mean().values.ravel())
print('Variance:', observed_variance)
def perm_test(df):
df = df.copy()
df['Outcome'] = np.random.permutation(df['Outcome'].values)
return df.groupby('Group').mean().var()[0]
perm_variance = [perm_test(df) for _ in range(5000)]

Clean Whitespace

Overview

clean_whitespace is a Bash script designed to remove extraneous whitespace from source code and text files. It helps maintain clean, readable files by stripping trailing whitespace from supported file types.

Features

  • Processes files recursively or in a single directory
  • Supports dry-run mode to preview changes
@leilanehirt
leilanehirt / exemplo.js
Created February 11, 2025 18:48
Exemplo Fetch API Post - Gits/GitHub
var msg='Hello World!';
console.log(msg);
@jdnichollsc
jdnichollsc / docker-compose.yml
Created February 11, 2025 18:48
Redis cluster mode enabled with Docker compose for local development
version: '3.6'
# Define name templates
x-name-templates:
project-name: &project-name ${COMPOSE_PROJECT_NAME:-solana}
service-names:
redis-node-0: &name-redis-0 ${COMPOSE_PROJECT_NAME:-solana}-redis-node-0
redis-node-1: &name-redis-1 ${COMPOSE_PROJECT_NAME:-solana}-redis-node-1
redis-node-2: &name-redis-2 ${COMPOSE_PROJECT_NAME:-solana}-redis-node-2
redis-node-3: &name-redis-3 ${COMPOSE_PROJECT_NAME:-solana}-redis-node-3
/mvnw text eol=lf
*.cmd text eol=crlf
// This Apps Script is for Google Sheets, and assigns random feedback partners from a list of names in Column A.
// You can use it to organize a feedback group.
//
// numPartners: number of feedback partners to assign. Defaults to 2.
// nameStartRow: the row that the name list starts on. Assumes names are in Column A. Defaults to row 3.
// outputStartCol: feedback partners will be outputted into every other column starting from outputStartCol. Defaults to Column F.
function assignFeedbackPartners(numPartners = 2, nameStartRow = 3, outputStartCol = 5) {
// Get the active spreadsheet and the active sheet
const sheet = SpreadsheetApp.getActiveSheet();
@nwlodychak
nwlodychak / multi_arm_bandit.py
Created February 11, 2025 18:47
Multi Arm Bandit algorithm - show more often the one that is leading while not neglecting the other offers
# Multi Arm Bandit
import numpy as np
import random
def multi_arm_bandit(epsilon = 0.1, A, B):
random = np.random.uniform(0, 1)
if random_value < epsilon:
# Exploration phase
arm = random.choice(['A', 'B'])
return random.choice(A if arm == 'A' else B)
This file has been truncated, but you can view the full file.
INFO - 2025-02-07 11:13:36,230 - kai - MainThread - [logging.py:134 - init_logging()] - We have inited the logger: file_logging: DEBUG console_logging: DEBUG
INFO - 2025-02-07 11:13:36,230 - kai.kai-rpc-logger - MainThread - [main.py:93 - main()] - using log config: log_level='DEBUG' stderr_log_level='TRACE' file_log_level='DEBUG' log_dir_path=PosixPath('/Users/jmatthews/git/jwmatthews/coolstore/.vscode/konveyor-logs') log_file_name='kai-rpc-server.log'
DEBUG - 2025-02-07 11:13:36,230 - kai.kai-rpc-logger - Thread-1 - [core.py:236 - run()] - Server thread started
INFO - 2025-02-07 11:13:36,230 - kai.kai-rpc-logger - MainThread - [main.py:115 - main()] - Started kai RPC Server
DEBUG - 2025-02-07 11:13:36,230 - kai.kai-rpc-logger - Thread-1 - [core.py:239 - run()] - Waiting for message
DEBUG - 2025-02-07 11:13:36,231 - kai.jsonrpc - Thread-1 - [streams.py:109 - recv()] - Waiting for message
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.swbc.com/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.swbc.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.swbc.com/">
<s:import namespace="http://microsoft.com/wsdl/types/" />
<s:element name="PostSinglePayment">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="Amount" type="s:double" />
<s:element minOccurs="1" maxOccurs="1" name="ConvenienceFee" type="s:double" />