Skip to content

Instantly share code, notes, and snippets.

View nsa-yoda's full-sized avatar
🎯
Focusing

Juan Sanchez nsa-yoda

🎯
Focusing
View GitHub Profile
@nsa-yoda
nsa-yoda / sphire_mantis_uuid.go
Created March 21, 2022 17:37
Sphire Mantis UUID <1.2.4 based on Jet/UUID
// Package uuid generates RFC4122-compliant UUIDs, and provides functions to marshal the UUIDs into their canonical form of 16 bytes and unmarshal them from a variety of formats. See https://tools.ietf.org/html/rfc4122.
package uuid
import (
"bytes"
"crypto/md5"
"crypto/rand"
"crypto/sha1"
"encoding/binary"
"encoding/hex"
import locale
from dataclasses import dataclass
@dataclass
class ProfitCalculator():
label: str
buy: float
sell: float
usd_amount: float
profit: float = 0.00
@nsa-yoda
nsa-yoda / confetti.html
Created October 19, 2020 14:56
CSS Confetti (gradient from colorzilla.com)
<!DOCTYPE html>
<html>
<head>
<title>confetti test</title>
<style>
.container {
width: 100%;
height: 100%;
}
@nsa-yoda
nsa-yoda / booleanCompareJoke.go
Last active October 18, 2020 21:23
Written as a joke...convoluted boolean comparison
package main
import (
"errors"
"fmt"
)
type BoolCompare struct {
left bool
right bool
import turtle as t
ARM_LENGTH = 30
FOOT_LENGTH = 30
RT_EYE_POS = [80, 0]
RT_PUPIL_POS = [78, 20]
# automatically calculate left eye
# and pupil positions based on right eye
const Hapi = require('@hapi/hapi');
const MongoClient = require('mongodb').MongoClient;
const server = Hapi.server({
port: 3000,
debug: {
request: ['*']
}
});
@nsa-yoda
nsa-yoda / OSRS.py
Created December 10, 2018 22:03
OSRS "Scamming" calculator - for those "selling 13 trout" noob alts. Calculates your profit per batch of items.
from prettytable import PrettyTable
data = [{
'purchase_price': 26,
'amount_purchased': 20,
'amount_sold': 13,
'sold_for': 3000
},{
'purchase_price': 26,
'amount_purchased': 116,
@nsa-yoda
nsa-yoda / reddit_lottery.txt
Last active November 3, 2022 18:37
Reddit History: /u/BlakeClass's comment on What to do if you win The Lottery
Congratulations! You just won millions of dollars in the lottery! That's great.
Now you're fucked.
No really.
You are.
You're fucked.
@nsa-yoda
nsa-yoda / lotto_mega_mean_topnums.py
Created September 13, 2017 20:34
Fetches JSON results from the NY lottery for lotto or mega and calculates mean and top 5 most recurring numbers (along with count)
import sys, urllib, json, math, operator, datetime
today = datetime.datetime.now()
endSearchDate = str(today.month + 1 if today.month + 1 <= 12 else today.month) + '/' + str(today.year)
game = 'mega' if sys.argv[1] == 'mega' else 'lotto'
url = 'http://nylottery.ny.gov/wps/PA_NYSLNumberCruncher/NumbersServlet?game='+game+'&action=winningnumbers&startSearchDate=08/2000&endSearchDate='+endSearchDate+'&pageNo=1&last=0&perPage=10000&sort=0'
datas = json.loads((urllib.urlopen(url)).read())
matrix = []
for data in datas['draw']:
# Buy price is the float value of the market price of the stock in question
buy_price = 0.623
# Budget is your budget for this purchase
budget = 400
# Per trade fee is any fee that you pay your brokerage house per transaction
per_trade_fee = 9.99
# This is your minimum desired return