Skip to content

Instantly share code, notes, and snippets.

View andrewsosa's full-sized avatar

Andrew Sosa andrewsosa

View GitHub Profile
@andrewsosa
andrewsosa / mergesort.py
Last active March 6, 2017 17:23
Minimalistic Merge sort in Python
def select(left, right):
"""Choose the minimum front from left and right, but handle empty lists."""
return left.pop(0) if (len(left) > 0 and len(right) is 0) or (len(left) > 0 and left[0] < right[0]) else right.pop(0)
def merge(left, right):
"""Conquer: Merge together the selected (min) front of left and right."""
return [select(left,right) for i in range((len(left) + len(right)))]
def sort(l):
"""Divide: Recursive call to split input list into managable sublists."""
@andrewsosa
andrewsosa / .zshrc
Created April 22, 2017 15:40
zshell config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/andrew/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="materialshell-oceanic"
@andrewsosa
andrewsosa / .hyper.js
Created April 22, 2017 15:42
hyper.js config
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@andrewsosa
andrewsosa / server.log
Created September 8, 2017 04:27
Someone tried to break into my site
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:01:58 +0000] "HEAD / HTTP/1.0" 503 0 "-" "Mozilla/5.0 Jorgee"
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:14:56 +0000] "HEAD /mysql/admin/ HTTP/1.0" 503 0 "-" "Mozilla/5.0 Jorgee"
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:14:56 +0000] "HEAD /mysql/dbadmin/ HTTP/1.0" 503 0 "-" "Mozilla/5.0 Jorgee"
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:14:56 +0000] "HEAD /mysql/sqlmanager/ HTTP/1.0" 503 0 "-" "Mozilla/5.0 Jorgee"
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:14:56 +0000] "HEAD /mysql/mysqlmanager/ HTTP/1.0" 503 0 "-" "Mozilla/5.0 Jorgee"
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:14:56 +0000] "HEAD /phpmyadmin/ HTTP/1.0" 503 0 "-" "Mozilla/5.0 Jorgee"
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:14:56 +0000] "HEAD /phpMyadmin/ HTTP/1.0" 503 0 "-" "Mozilla/5.0 Jorgee"
nginx.1 | 162.243.44.174 172.17.0.1 - - [07/Sep/2017:23:14:57 +0000] "HEAD /phpMyAdmin/ HT
@andrewsosa
andrewsosa / passwd.py
Created October 18, 2017 14:11
[DigitalOcean Web Console Login] #tags: digitalocean
from pynput.keyboard import Key, Controller
import time
keyboard = Controller()
# # Press and release space
# keyboard.press(Key.space)
# keyboard.release(Key.space)
#
@andrewsosa
andrewsosa / proposal.py
Created November 10, 2017 17:20
[ApiMultiView Proposal] A view which tasks out work() calls to delegate ApiView classes
#
# hackfsu_com.views.generic.api_multi_view
#
class ApiMultiView(ApiView):
http_method_names = [] # This must be overridden for every multiview
http_delegates = {} # Dictionary of delegate ApiView objects, key is the method
def work(self, request: HttpRequest, req: dict, res: dict):
PROMPT='%m %{$fg[green]%}%c%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX=" ("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY=" ✗"
ZSH_THEME_GIT_PROMPT_CLEAN=" ✔"
@andrewsosa
andrewsosa / guidelines.md
Last active July 2, 2018 18:06
Recommended Git workflow for Open Source/Multi-Contributor Projects

Recommended Workflow

Good for Open Source/Multi-contributor projects

Table of contents:
  1. Overview
  2. Step Details
  3. Important Details/Warnings
Key terms
  • Upstream: The original, organization-based repo (e.g. fsu-acm/contest-suite).
@andrewsosa
andrewsosa / dijkstra.py
Created January 4, 2020 16:33
Dijkstra Implementation
"""
Implementation is inspired by this article:
https://dev.to/mxl/dijkstras-algorithm-in-python-algorithms-for-beginners-dkc
Graph is from this video:
https://www.youtube.com/watch?v=gdmfOwyQlcI
"""
import math
@andrewsosa
andrewsosa / spire-of-stars.md
Last active July 25, 2020 22:57
How To: Spire of Stars

Start Phase

  • Everyone clears ads.
  • When the ball spawns, the closest person will call out and grab it, and everyone else will line up.
  • Everyone passes the ball down the line.
  • After everyone has held the ball, the last person throws it at the boss.

Space Phase #1 (Scout Phase)

  • If you receive the Superior Retainer buff, immediately call it out.
  • One Superior Retainer should declare they will go to space. They are the Alpha Retainer. The two others are Beta Retainers.
  • The Beta Retainers and non-retainers should appoach the platforms, but kill the gladiators before standing on the them. One person will not have a platform.