Skip to content

Instantly share code, notes, and snippets.

View vc1492a's full-sized avatar
🚀
Let's ride!

Valentino Constantinou vc1492a

🚀
Let's ride!
View GitHub Profile
@rasmusab
rasmusab / probability_of_pregnancy.R
Created November 5, 2015 19:46
A script that implements a Bayesian model calculating the probability that a couple is fertile and is going to be pregnant.
# A Bayesian model that calculates a probability that a couple is fertile
# and pregnant. Please use this for fun only, not for any serious purpose
# like *actually* trying to figure out whether you are pregnant.
# Enter your own period onsets here:
period_onset <- as.Date(c("2014-07-02", "2014-08-02", "2014-08-29", "2014-09-25",
"2014-10-24", "2014-11-20", "2014-12-22", "2015-01-19"))
# If you have no dates you can just set days_between_periods to c() instead like:
# days_between_periods <- c()
days_between_periods <- as.numeric(diff(period_onset))
import numpy as np
from numpy.linalg import norm, solve
from scipy.spatial.distance import cdist
from sklearn.neighbors import kneighbors_graph
def phi(l, mu):
return (mu * (np.sqrt(l) - 1)**2)
@fabianp
fabianp / gist:1046959
Created June 25, 2011 22:15
Hilbert matrix in Python
"""
Hilbert matrix using numpy. Contains:
- hilb(n, m) : returns the Hilbert matrix of size (n, m)
- invhilb(n) : returns the inverse of the Hilbert matrix of size (n, n)
"""
import numpy as np
from math import factorial
@Falconerd
Falconerd / gulpfile.js
Last active April 10, 2019 17:16
Gulp + Watchify + Babelify + BrowserSync
/**
* This gulpfile will copy static libraries and a index.html file as well as
* merge, babelify and uglify the rest of the javascript project.
*
* TODO:
* - Separate media, libs and src with different watchers.
* - Media and libs should only be copied to dist if they are different sizes.
*
* The expected project is to be laid out as such:
*
@asitang
asitang / DAG_in_Plotly.py
Last active February 11, 2021 16:09
A minimalistic Topological layout for DAGs using NetworkX and Plotly
import networkx as nx
import plotly.graph_objects as go
def plotly_DAG(nx_dag, node_description_dict):
"""
nx_dag: a networkX directed acyclic graph
node_description_dict: a nested dictionary that contains node attributes to show on hover
eg. {
'node_A':{'property_1':'value_A_1', 'property_2':'value_A_2'},
'node_B':{'property_1':'value_B_1', 'property_2':'value_B_2'}
@rainyear
rainyear / handy.py
Created July 3, 2015 10:09
Hand posture detection with OpenCV.
#!/usr/bin/env python
import cv2
import numpy as np
def main():
cap = cv2.VideoCapture(0)
while(cap.isOpened()):
ret, img = cap.read()
skinMask = HSVBin(img)
@arfon
arfon / generate
Last active April 6, 2023 10:37
Let's try and generate some codemeta files.
#!/usr/bin/ruby
# For an OO language, this is distinctly procedural. Should probably fix that.
require 'json'
details = Hash.new({})
capture_params = [
{ :name => "title", :message => "Enter project name." },
{ :name => "url", :message => "Enter the URL of the project repository." },
@gagarine
gagarine / install-clamav-osx.md
Last active June 7, 2023 07:54
Howto Install clamav on OSX with brew

Howto Install clamav on OSX with brew

Note: on legacy intel system the path may be /usr/local/etc/clamav instead of /opt/homebrew/etc/clamav/

$ brew install clamav
$ cd /opt/homebrew/etc/clamav/
$ cp freshclam.conf.sample freshclam.conf
@dannguyen
dannguyen / iowa-liquor-sales-dataset.readme.md
Last active July 8, 2023 12:27
Cleaning, summing up the State of Iowa Liquor Sales dataset

Iowa Liquor Sales dataset via Socrata/data.iowa.gov

(preliminary exploration)

The state of Iowa has released an 800MB+ dataset of more than 3 million rows showing weekly liquor sales, broken down by liquor category, vendor, and product name, e.g. STRAIGHT BOURBON WHISKIES, Jim Beam Brands, Maker's Mark

This dataset contains the spirits purchase information of Iowa Class “E” liquor licensees by product and date of purchase from January 1, 2014 to current. The dataset can be used to analyze total spirits sales in Iowa of individual products at the store level.

You can view the dataset via Socrata

@fire1ce
fire1ce / Raspberry Pi 3 TOR Access Point Router.md
Last active November 4, 2023 06:39
Raspberry Pi 3 TOR Access Point Router

THIS GIST WON'T BE UPDATED ANY MORE (24/10/18)

Follow the progress of this project here 3os.org Raspberry Pi 3 TOR Access Point Router Project

Network: Router RJ45 <--> Ethernet Port on Raspberry <--> TOR <--> Raspberry WIFI AC <--> WIFI CLIENT

# -- Download Rasbian Strech Lite from: https://www.raspberrypi.org/downloads/raspbian/