Skip to content

Instantly share code, notes, and snippets.

View abromberg's full-sized avatar

Andy Bromberg abromberg

View GitHub Profile
@abromberg
abromberg / metaverse.json
Created December 3, 2021 05:47
metaverse
{
"entities": [
{ "id":"backdrop", "environment":"preset:contact" }
],
"embeds":[
{ "id":"video", "position": { "x": 3, "y": 4, "z": 19 }, "rotation": { "x": 0, "y": 180, "z": 0}, "scale": 45, "html": "<video autoplay loop='true' crossorigin='anonymous' src='https://cdn-cf-east.streamable.com/video/mp4/mizxqv.mp4?Expires=1638769560&Signature=imQ9ay6bwQS1cmpLQzxGcLWFEmVqOErjtljnez0TgR5uQNJgdktGsevwczoDONn0yYTR~l1xOrXNVZf8jrdYmsIthapqlLIMKNrCIB3FdenE8IIFtog8EGyDOD7-CWS-mtmvL2iKbqCiau1~hkVc9828gaNdfhTHEau9DbQTQgYbJ12KYarIB97DDhj3oNFqcs4RLKqeDnNPi3gufwD8j8dfG4hIU1-p6tqOXauh0m7Oj5w8p-44YJxLRIqvb-~ScIs3GX8hR9-O5FLyAvKhOGV71o1nSX0q~VLO2~Up9I5fYjY5W~nPoqqJvgoF0xRXhRDy9ieybI3347HB6mRYQg__&Key-Pair-Id=APKAIEYUVEN4EVB2OKEQ' type='video/mp4' playsinline webkit-playsinline style='position: absolute;z-index: -1000;'></video>" }
]
}

Keybase proof

I hereby claim:

  • I am abromberg on github.
  • I am andybromberg (https://keybase.io/andybromberg) on keybase.
  • I have a public key whose fingerprint is 5C33 874B CE22 7BEE 8940 54DC 4176 BCC9 0CF3 07F6

To claim this, I am signing this object:

@abromberg
abromberg / bitcoincreated.py
Last active December 16, 2015 18:48
Function to determine theoretical number of Bitcoin in existence as a function of the number of days since January 3, 2009, when Bitcoin mining began.
from math import floor
def B(t):
max = 21*(10**6) # hard cap on number of BTC
C = 7200 # initial number of BTC produced per day
T = 4*365 # number of days in 4 years
B = sum(C / 2**int(floor(i/T)) for i in range(0, t))
return min(B, max)
#import libraries to work with
library(plyr)
library(stringr)
library(e1071)
#load up word polarity list and format it
afinn_list <- read.delim(file='AFINN/AFINN-111.txt', header=FALSE, stringsAsFactors=FALSE)
names(afinn_list) <- c('word', 'score')
afinn_list$word <- tolower(afinn_list$word)
binom.test(confTable[1,1] + confTable[2,2], nrow(results), p=0.5)
confTable <- table(predict(classifier, results), results[,6], dnn=list('predicted','actual'))
confTable
classifier <- naiveBayes(results[,2:5], results[,6])
#function to calculate number of words in each category within a sentence
sentimentScore <- function(sentences, vNegTerms, negTerms, posTerms, vPosTerms){
final_scores <- matrix('', 0, 5)
scores <- laply(sentences, function(sentence, vNegTerms, negTerms, posTerms, vPosTerms){
initial_sentence <- sentence
#remove unnecessary characters and split up by word
sentence <- gsub('[[:punct:]]', '', sentence)
sentence <- gsub('[[:cntrl:]]', '', sentence)
sentence <- gsub('\\d+', '', sentence)
sentence <- tolower(sentence)
#load up word polarity list and format it
afinn_list <- read.delim(file='AFINN/AFINN-111.txt', header=FALSE, stringsAsFactors=FALSE)
names(afinn_list) <- c('word', 'score')
afinn_list$word <- tolower(afinn_list$word)
#categorize words as very negative to very positive and add some movie-specific words
vNegTerms <- afinn_list$word[afinn_list$score==-5 | afinn_list$score==-4]
negTerms <- c(afinn_list$word[afinn_list$score==-3 | afinn_list$score==-2 | afinn_list$score==-1], "second-rate", "moronic", "third-rate", "flawed", "juvenile", "boring", "distasteful", "ordinary", "disgusting", "senseless", "static", "brutal", "confused", "disappointing", "bloody", "silly", "tired", "predictable", "stupid", "uninteresting", "trite", "uneven", "outdated", "dreadful", "bland")
posTerms <- c(afinn_list$word[afinn_list$score==3 | afinn_list$score==2 | afinn_list$score==1], "first-rate", "insightful", "clever", "charming", "comical", "charismatic", "enjoyable", "absorbing", "sensitive", "intriguing", "powerful", "pleasant", "
posText <- read.delim(file='polarityData/rt-polaritydata/rt-polarity-pos.txt', header=FALSE, stringsAsFactors=FALSE)
posText <- posText$V1
posText <- unlist(lapply(posText, function(x) { str_split(x, "\n") }))
negText <- read.delim(file='polarityData/rt-polaritydata/rt-polarity-neg.txt', header=FALSE, stringsAsFactors=FALSE)
negText <- negText$V1
negText <- unlist(lapply(negText, function(x) { str_split(x, "\n") }))