Skip to content

Instantly share code, notes, and snippets.

View ericm's full-sized avatar
Working on projects

Eric Moynihan ericm

Working on projects
View GitHub Profile
@ericm
ericm / gsettings.sh
Created October 25, 2021 14:02
gsettings mouse profile
gsettings set org.gnome.desktop.peripherals.mouse speed 0
gsettings set org.gnome.desktop.peripherals.mouse accel-profile 'flat'
@ericm
ericm / .vimrc
Last active April 5, 2021 13:49
.vimrc
set tabstop=4
set shiftwidth=4
set expandtab
" vim-bootstrap 2021-03-29 19:11:41
"*****************************************************************************
"" Vim-Plug core
"*****************************************************************************
let vimplug_exists=expand('~/.vim/autoload/plug.vim')
if has('win32')&&!has('win64')
@ericm
ericm / codeforces1315A.py
Created February 27, 2020 11:31
codeforces1315A.py
t = int(input())
abxy = []
for _ in range(t):
abxy.append(tuple((int(x) for x in input().split())))
for ab in abxy:
ded = (ab[2], ab[3])
res = (ab[0], ab[1])
x = (res[0]-ded[0], ded[0])
y = (res[1]-ded[1], ded[1])
@ericm
ericm / koordechat.txt
Created February 26, 2020 23:36
Koorde Chat
Base 10 Koorde allows a user 10 direct connections to other users.
Just like a graph in a social network, these direct connections will be drawn based on message connections.
However users will message >10 users so more is required.
We can replace direct connecitons based on a LRU policy.
Try to optimize and move peers closer together (by degree) if there's a lot of activity between them.
Due to the nature of the DHT being optimized for access to every node, use this to allow users to connect to new users
Possible way to initiate and maintain connections.
Generate a URL with data encoded in it that will give a user all 10 of its peers IP's.
Peer will announce to all 10 instantly and try to initiate a connection with them.
@ericm
ericm / koorde.md
Created February 26, 2020 23:15
Base 10 Koorde rethink

Koorde in base 2

2^d = nodes
i = d-bit id
aware of = 2i%2^d && (2i+1%2^d)

Koorde

  • Koord's De Bruijin graph has average lookup of O(logk(n)) where k is the base.
  • the more we increase the base k, the lower the avg lookup time.

Koorde in base 10

@ericm
ericm / solver.py
Last active February 20, 2020 12:39
Sudoku solver in progress
class Solution:
def solveSudoku(self, board: List[List[str]]) -> None:
"""
Do not return anything, modify board in-place instead.
"""
# Ui[j] i = ith, j = [box, column, row]
gen = lambda: range(1, 10)
missing = [(set(gen()),set(gen()),set(gen())) for _ in range(9)]
# Populate missing
@ericm
ericm / autoconfig.cfg
Created January 10, 2020 16:04
CSGO config
echo "READING CONFIG"
// Buy binds
bind "kp_end" "buy ak47; buy m4a1;"
bind "kp_downarrow" "buy mac10; buy mp9;"
bind "kp_pgdn" "buy ump45;"
bind "kp_leftarrow" " buy smokegrenade;"
bind "kp_5" " buy incgrenade; buy molotov;"
bind "kp_rightarrow" " buy flashbang;"
bind "kp_plus" " buy hegrenade;"
bind "kp_home" "buy deagle; buy revolver;"
@ericm
ericm / logistic_regression.md
Last active December 18, 2019 22:40
Logistic Regression

Logistic Regression Classification aka using sigmoid

  • Linear regression with h(x) >= .5 || < .5 requires feature scaling and ins't accurate.

  • We require 0 <= h(x) <= 1 for binary classification.

Function

  • Sigmoid function is logistic function
  • h(x) = g(θ'x)
  • g(x) = 1/(1+e^(-z))
@ericm
ericm / infixToPostfix.py
Created September 27, 2019 12:50
Infix to Postfix
from stackA import Stack
def infix():
syms = Stack()
pf = input("Type infix:")
inp = pf.strip(" ")
out = []
for sym in inp:
if sym in ["*", "/", "+", "-", "("]:
@ericm
ericm / tetrisMultiStack.py
Created September 27, 2019 12:15
Algorithm lab game
from stackA import Stack
from random import randint
from datetime import datetime
COLOURS = ["Red", "Green", "Blue"]
rand = lambda: randint(0, 2)
# Single stack
stacks = [Stack() for i in range(5)]