Skip to content

Instantly share code, notes, and snippets.

View farice's full-sized avatar
⚛️

Faris Sbahi farice

⚛️
View GitHub Profile
@farice
farice / keybase.md
Created October 4, 2021 12:23
keybase.md

Keybase proof

I hereby claim:

  • I am farice on github.
  • I am farissbahi (https://keybase.io/farissbahi) on keybase.
  • I have a public key ASDYpPJOSSwUgwTO-ISoh2gVNCY3TMJz8zl8eKUcwwg4dwo

To claim this, I am signing this object:

from qutip import *
import numpy as np
# Consider image relative to |+> in cos(\theta) |+> + e^(i\phi) |-> representation.
def extract_theta_phi(single_qubit_gate, b=snot() * basis(2,0)):
# apply gate to |+>
ket = single_qubit_gate * b
alpha = ket.full()[0][0]
beta = ket.full()[1][0]
@farice
farice / duchi_notes_errata.md
Last active July 24, 2019 20:23
Stats 311 Lecture Notes - Duchi - Errata
  • Example 14.1 (Bernoulli Distribution):
p^x(1-p)^(1-x) = exp[xlog(p) + (1-x) log(1-p)]
## https://xkcd.com/1185/
import random
def panicSort(list):
if isSorted(list)
return list
for i in range(10000):
pivot = random(0, len(list))
list = list[pivot:] + list[:pivot]
@farice
farice / get_historical_data.py
Last active January 7, 2018 00:44
Retrieve historical data from the GDAX API and output to CSV
import requests
import datetime
import time
import csv
import progressbar
import argparse
import logging
url = 'https://api.gdax.com'
bar = progressbar.ProgressBar(max_value=1, redirect_stdout=True)
import getpass
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
userStr = raw_input("Username: ")