Skip to content

Instantly share code, notes, and snippets.

@sonnyksimon
sonnyksimon / probability.py
Last active January 13, 2021 19:13
Calculate the probability of atleast one match after x tries
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# SPDX-License-Identifier: MIT
#
""" Calculate the probability of atleast one match after x tries"""
from __future__ import print_function
import argparse
co3325
co3326
co3354
co3355
declare
l_message varchar2(32767);
l_script_id varchar2(255);
c integer := 0;
l_inserts number := 0;
l_selects varchar2(1);
begin
eba_dbtools_design_schema_pub.init_collections;
begin
import platform
import subprocess
def ping(host):
""" Returns True if host (str) responds to a ping request. """
if platform.system().lower() == 'windows':
param = '-n'
else:
param = '-c'
command = ['ping', param, '1', host]
@sonnyksimon
sonnyksimon / dfs.py
Last active July 6, 2020 16:55
depth-first search in Python
# Using a dictionary to act as an adjacency list
graph = {
'A' : ['B','C'],
'B' : ['D', 'E'],
'C' : ['F'],
'D' : [],
'E' : ['F'],
'F' : []
}
"Comments lie."
- A cynical but smart and good looking programmer.
Desirability -> Design -> Implement -> Test -> Review -> Commit
@sonnyksimon
sonnyksimon / schema.py
Last active January 7, 2020 19:15
sql: Another way of using SQLALchemy
import sql
from settings import engine
sql.Table.engine = engine
class Blog(sql.Table):
id = sql.String(255)
title = sql.String(255)
body = sql.String(4096)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
nnsigmoid
~~~~~~~~~
A simple neural network using the sigmoid
function in Python.
:copyright: Pancubs.org
@sonnyksimon
sonnyksimon / web.py
Last active December 20, 2019 15:02
A label for a merger between Flask and web.py's database API.
# -*- coding: -*-
"""
web
~~~
A label for a merger between Flask and web.py's database API.
import flaskweb as web
app = web.app(__name__)