Skip to content

Instantly share code, notes, and snippets.

View Ugrend's full-sized avatar

Ugrend Ugrend

View GitHub Profile
@Ugrend
Ugrend / medicare_card.js
Created May 11, 2018 05:12
Random Medicare Card Generator
//Reference: http://www.clearwater.com.au/code/provider
const randomMedicareNumber = ()=>{
let sum = Math.floor(Math.random() * 5) +2;
const weights = [1, 3, 7, 9, 1, 3, 7, 9];
let num = [sum]
for(let i = 0 ; i < 7 ; i++){
let n = Math.floor(Math.random()*10)
sum += n * weights[i+1];
@Ugrend
Ugrend / backup.sh
Last active April 10, 2017 00:45
Simple rsync backup
#!/usr/bin/env bash
# This is a simple backup script
# I have lots of static non changing data, I wish to back it up accross multiple disks
# The idea is that in the event of total data loss, I can restore the data disk by disk
# If one of the disks dies or is faulty, I would only lose the data on that disk,
#I would still be able to recover other files from other disks
#
# Basically this script will rsync files from the specified path to the backup path until the disk is full
# Once the disk is full, rsync will error and send me a email stating the disk is full
{"title": "The Complete Works of Someone",
"contents":
[{"url": "https://www.reddit.com/r/HFY/comments/37fnu0/the_big_b/", "title": "The Tale of Foo and Bar"}]}
@Ugrend
Ugrend / problem_16.py
Created May 19, 2015 15:27
Project Euler - Problem 16
print sum(int(x) for x in str(2**1000))
class SessionHandler():
def __init__(self):
pass
self.sessions = {}
def removeOldSessions(self):
for key,sessions in self.sessions.iteritems():
@Ugrend
Ugrend / cooltext.py
Last active May 9, 2016 09:08
cooltext.py
import random
shittalk = list("Wot the fok did ye just say 2 us m8? we dropped out of newcastle primary skool were the sickest blokes ull ever meet & weve nicked ova 300 chocolate globbernaughts frum tha corner shop. we trained in street fitin' & were the strongest fokers in tha entire newcastle gym. yer nothin to us but a cheeky lil bellend w/ a fit mum & fakebling. we'll waste u and smash a fokin bottle oer yer head bruv, we swer 2 christ. ya think u can fokin run ya gabber at us whilst sittin on yer arse behind a lil screen? think again wanka. we callin our homeboys rite now preparin for a proper scrap. A roomble thatll make ur nan sore jus hearin about it. yer a waste bruv. our crew be all over tha place & ill beat ya to a proper fokin pulp with our fists wanka. if i aint satisfied w/ that we'll borrow our m8s cricket paddle & see if that gets u the fok out o' newcastle ya daft kunt. if ye had seen this bloody fokin mess commin ye might a' kept ya gabber from runnin. but it seems yea stupid lil twat, inn
@Ugrend
Ugrend / fixcorrupticons.bat
Last active August 29, 2015 14:05
fix black/corrupt transparent icons
@echo off
REM i shouldnt have to do this but it has come to this
REM when i reboot transparent icons become black
REM googlefu has failed me and I see people with same problems but people keep giving same answers that DONT work
REM removing iconcahce works, but fucks up after reboot
REM so this script will remove iconcache at startup kill explorer.exe and start it up again so hopefully it fixes this shit
REM place this in startup folder
@Ugrend
Ugrend / steam_total_spent.js
Last active August 29, 2015 14:03
get total spent on steam
// ==UserScript==
// @name transactions
// @namespace store.steampowered.com/account
// @include https://store.steampowered.com/account/
// @version 1
// @grant none
// ==/UserScript==
var elements = document.getElementsByClassName('transactionRowPrice');
var total = 0
@Ugrend
Ugrend / blackjack.py
Created June 2, 2014 13:28
crappy blackjack
#Crappy Blackjack
import random
import sys
def init_card_deck():
cards = [{11:"ACE OF HEARTS"},
{11:"ACE OF DIAMONDS"},
{11:"ACE OF SPADES"},
{11:"ACE OF CLUBS"},
{10:"KING OF HEARTS"},