Skip to content

Instantly share code, notes, and snippets.

Avatar

InstanceLabs instance01

View GitHub Profile
View hadamard_qiskit_3_qubits.py
import qiskit as qk
simulator = qk.BasicAer.get_backend('statevector_simulator')
q = qk.QuantumRegister(3)
c = qk.ClassicalRegister(3)
total_sum = None
View predecon.py
# PreDeCon - Projected Clustering
# Paper: Density Connected Clustering with Local Subspace Preferences, Böhm et al., 2004
# This code is not optimized.
import numpy as np
def get_neighbor(X, candidate):
"""Return the eps-neighbors of candidate.
"""
neighbors = []
View pyramidal_time_frame_model.py
# More information: "A Framework for Clustering Evolving Data Streams", Aggarwal, 2003
# This does not deal with redundancy (which apparently is rampant).
import math
alpha = 2
beta = 2
levels = []
View uniform_time_warping.py
# Calculate uniform time warping (UTW) of two small time series.
# The arguably better alternative is dynamic time warping (DTW).
import numpy as np
X = np.array([3, 5, 9, 2, 3, 6, 3])
Y = np.array([3, 4, 6, 10, 1, 3, 2, 7, 4])
X_len = X.shape[0]
Y_len = Y.shape[0]
X = np.repeat(X, Y_len)
View cohens_kappa.py
import numpy as np
def calc_cohens_kappa(matrix):
p0 = (matrix[0][0] + matrix[1][1]) / matrix.sum()
pyes = (matrix[0].sum() / matrix.sum()) * ((matrix[0][0] + matrix[1][0]) / matrix.sum())
pno = (matrix[1].sum() / matrix.sum()) * ((matrix[0][1] + matrix[1][1]) / matrix.sum())
pe = pyes + pno
k = (p0 - pe) / (1 - pe)
print(k)
@instance01
instance01 / TextBookSearch.md
Last active Dec 6, 2017 — forked from cmbaughman/TextBookSearch.md
Searching for Text Books
View TextBookSearch.md

Note: I found this on the /r/Piracy subreddit (https://www.reddit.com/r/Piracy/comments/3i9y7n/guide_for_finding_textbooks/?sort=confidence) however I am including a copy here just in case.

So you have a list of books you need to buy for college. There are some really great resources for finding them online, but I'm going to run through the easiest methods for searching all of them here.

First, let's start off by using the method that will allow you to find the vast majority of books. Google. It tends to be easier if you can search multiple sites at once, and this is the easiest way to do it.

There was a search engine that /u/ratokursi made 3 years ago, but by now most of the sites are either dead or have changed the url. I decided to make a new one, this time after reviewing 100+ sites and adding to working ones to the custom search engine.

https://cse.google.com/cse/publicurl?cx=011394183039475424659:5bfyqg89ers

@instance01
instance01 / tera_manifest_fix.txt
Created Jul 12, 2016
Tera "Unable to download manifest" Error Fix
View tera_manifest_fix.txt
1. Open elevated console
2. Type "netsh winhttp reset proxy"
You can now download the latest patch successfully. If this doesn't work, try the official fixes on the enmasse website, or google furthermore regarding WinHttp.
Apparently I used the WinHttp library some time (maybe in my Proxy program) and forgot to remove the proxy again.
Now be aware that you cannot remove the proxy through the standard internet settings in windows, you have to reset it with the command.
Tested on Windows 10