Skip to content

Instantly share code, notes, and snippets.

@wcharczuk
wcharczuk / keybase.md
Created May 26, 2015 20:41
keybase.md

Keybase proof

I hereby claim:

  • I am wcharczuk on github.
  • I am wcharczuk (https://keybase.io/wcharczuk) on keybase.
  • I have a public key whose fingerprint is 0709 214A D115 6D81 F954 279D 60B0 4013 AFE9 F2B1

To claim this, I am signing this object:

@wcharczuk
wcharczuk / word_path.py
Last active October 22, 2016 03:25
Generate "Word Path" Between Two Words
#goal is to compute the 'path' from one valid word to another by only changing one letter at a time (forming valid words inbetween)
#example:
# cat -> dog
# cat -> cot -> cog -> dog
import sys
import string
alphabet = string.ascii_lowercase
#!/usr/bin/python
import sys
keyboard = []
keyboard.append(['A', 'B', 'C', 'D', 'E', 'F'])
keyboard.append(['G', 'H', 'I', 'J', 'K', 'L'])
keyboard.append(['M', 'N', 'O', 'P', 'Q', 'R'])
keyboard.append(['S', 'T', 'U', 'V', 'W', 'X'])
keyboard.append(['Y', 'Z', '1', '2', '3', '4'])
# Put any initialization logic here. The context object will be passed to
# the other methods in your algorithm.
def initialize(context):
context.security = symbol('SPY')
context.date = None
context.buy_amt = 1000
set_commission(commission.PerTrade(cost=0.03))
set_slippage(slippage.VolumeShareSlippage(volume_limit=0.25, price_impact=0.1))
@wcharczuk
wcharczuk / gist:d65364edeb57853bd55d
Created May 20, 2014 14:40
Postgres toy example of in statement
CREATE TABLE id_test ( id varchar(255) not null );
ALTER TABLE id_Test ADD CONSTRAINT PK_id_test_id PRIMARY KEY (id);
INSERT INTO id_test
select uuid_generate_v1() as id from generate_series(1,10000);
select '''' || id || ''',' from id_test limit 100
--these values go in the 'in' statement below
select * from id_test where id in (
@wcharczuk
wcharczuk / queens.scala
Created February 27, 2014 15:11
Solution to the 8 Queens Problem in Scala
class Board() {
val min_rank = 0
var max_rank = 8
val min_file = 0
var max_file = 8
var data : Array[Array[Square]] = null
def initialize(ranks : Int, files: Int) = {
@wcharczuk
wcharczuk / gitcoin-miner.cs
Created January 28, 2014 15:57
Stripe CTF Level 1 Gitcoin Miner in C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Gitcoin_Miner
{
@wcharczuk
wcharczuk / tournament.scala
Created December 9, 2013 21:56
Chess Tournament Simulator
val max_players = 32;
val player_pool_size = 32;
val tournaments = 24; //156;
val rating_floor = 100;
val rating_disparity = 400;
//can be swapped out for full USCF system
@wcharczuk
wcharczuk / reflection_test.cs
Last active December 29, 2015 13:39
a reflection test
/*
::OUTPUT::
Starting tests ...
Standard Reflection Time 48.12ms
Fast Reflection Time 35.225ms
Fastest Reflection Time 34.655ms
Tests Complete!
::END OUTPUT::
@wcharczuk
wcharczuk / screenfetch
Created October 25, 2013 02:25
my modified screenfetch
#!/usr/bin/env bash
# screenFetch
# Script to fetch system and theme settings for screenshots in most mainstream
# Linux distributions.
# Copyright (c) 2010-2012 Brett Bohnenkamper < kittykatt AT archlinux DOT us >
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software