Skip to content

Instantly share code, notes, and snippets.

View strboul's full-sized avatar

Metin Yazici strboul

View GitHub Profile
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
import string
import random
message = "hello world from python"
# secret = ''.join(random.choices(string.ascii_uppercase + string.digits, k=100))
secret = 'bob'
encrypted = ''.join([chr(ord(a) ^ ord(b)) for a, b in zip(message, secret)])
decrypted = ''.join([chr(ord(a) ^ ord(b)) for a, b in zip(encrypted, secret)])

Keybase proof

I hereby claim:

  • I am strboul on github.
  • I am strboul (https://keybase.io/strboul) on keybase.
  • I have a public key ASB-QR3015IubTjaSubzmM12zzDk8pvITKhfPqr_MJAXGwo

To claim this, I am signing this object:

@strboul
strboul / calc_growth.py
Created October 23, 2021 14:57
if a business has $x revenue and $y% fixed growth rate every year, how much revenue will it have in the next $z years?
from pprint import pprint
def calc_growth(revenue, fixed_rate, years):
"""Calculate growth rate
revenue: Initial revenue.
fixed_rate: fixed rate to grow in a year. It's between 0 and 1.
years: number of years.
"""
init_revenue = revenue
@strboul
strboul / compound.R
Last active March 16, 2018 21:46
compound_interest.R
# How much interest etc. would you pay for a mortgage?
compound <- function(rate, money, n) {
prin <- money * (1+rate/100)^(0:(n-1))
int <- prin * (rate/100)
totalInt <- sum(int)
totalMoney <- money + totalInt
rentpermonth <- totalMoney / (n * 12)
textTable <- c(
cat(rep("=", 30), "\n ", sep=""),
days <- seq_along(1:365)
points <- list()
for (i in days) {
points[[i]] <- exp(-i/500)
}
x <- unlist(points)
df <- cbind.data.frame(x, days)