Skip to content

Instantly share code, notes, and snippets.

Hello old friend!

Necronet necronet

Hello old friend!
View GitHub Profile
necronet / Metropolis-King-Example.R
Created Aug 5, 2022
Statistical Rethinking example for MCMC
View Metropolis-King-Example.R
num_weeks <- 1e5
position <- rep(0, num_weeks)
current <- 10
for (i in 1:num_weeks) {
position[i] <- current
proposal <- current + sample( c(-1, 1), size = 1)
if (proposal < 1) proposal <- 10
if (proposal > 10) proposal <- 1
prob_move <- proposal/current
necronet /
Created Mar 31, 2021
Open PR for a specific commit
# Get PR number for a specific commit
local pr_number=$(git log --reverse --ancestry-path <commit_id>..master --grep="Merge pull request" --oneline | head -n 1 | awk '{print $5}' | sed -E 's/#//g')
# Open PR in the browser
open "$pr_number"
necronet /
Created Mar 30, 2021
Get Merged Manifest android and copy to clipboard
cat <module_name>/build/intermediates/merged_manifest/celrayDebug/out/AndroidManifest.xml | pbcopy
necronet /
Created Jan 2, 2021
An easy example of some aws console operation for dynamodb
# List all the tables using a profile
aws dynamodb list-tables --profile <profile_name> | jq
# Get all item in a table using a profile (expensive)
aws dynamodb scan --table-name <table_name> --profile <profile_name> | jq
# Get an specific item based on id using a profile
aws dynamodb get-item --key '{"id":{"S":"009871"}}' --table-name <table_name> --profile <profile_name> | jq
# Create an item using a profile
necronet / residual.R
Created Jul 13, 2020
Find the largest residual of 2 digits number that can be divided by the sum of itself
View residual.R
# Find the largest residual of 2 digits number that can be divided by the sum of itself
# maxres(ab/(a+b))
count <- 0
max_index <- 0
for( i in 10:99) {
digits <- as.integer(substring(i, seq(nchar(i)), seq(nchar(i))))
aplusb <- digits[1] + digits[2]
necronet / variation.R
Created Jul 4, 2020
Get all numbers 3 digits, divisible by 3 that follow this formula, a + 3b + c where a != 0
View variation.R
# Get all numbers 3 digits, divisible by 3 that follow this formula
# a + 3b + c where a != 0
count <- 0
n <- c()
for( i in 100:999) {
digits <- as.integer(substring(i, seq(nchar(i)), seq(nchar(i))))
formula <- (digits[1] + 3*digits[2] + digits[3])
necronet / ptf_data_extraction.R
Last active Jun 27, 2020
Quickly filtering data for PTF
View ptf_data_extraction.R
data <- readr::read_csv('data.csv')
data_cleaned <- data %>% filter(!stringr::str_detect(Page, "@powertofly\\.com")) %>%
mutate(Registrations =
necronet / lambda_selection_glmnet.R
Created Jun 18, 2020
Quick gist to show lambda selection difference between explicit and heuristic
View lambda_selection_glmnet.R
x_var <- data.matrix(mtcars[, c("hp", "wt", "drat")])
y_var <- mtcars[, "mpg"]
fit_lambda_specified <- cv.glmnet(x_var, y_var, alpha = 0, lambda = 10^seq(5, -5, by = -.1))
fit_lambda_automatic <- cv.glmnet(x_var, y_var, alpha = 0)
plot(fit_lambda_specified, xvar="lambda")
plot(fit_lambda_automatic, xvar="lambda")
necronet / spacyr_bug.R
Created Jun 5, 2020
Spacy R crashes on tokenizer
View spacyr_bug.R
corpus <- readr::read_csv("corpus.csv")
# Work with
#t <- corpus$text[1:100]
t <- corpus$text[124]
necronet / corpus.csv
Created Jun 5, 2020
spacyr crash on tokenizer
View corpus.csv
We can't make this file beautiful and searchable because it's too large.
Stuning even for the non-gamer: This sound track was beautiful! It paints the senery in your mind so well I would recomend it even to people who hate video game music! I have played the game Chrono Cross but out of all of the games I have ever played it has the best music! It backs away from crude keyboarding and takes a fresher step with grate guitars and soulful orchestras. It would impress anyone who cares to listen! ^_^,__label__2
" The best soundtrack ever to anything.: I'm reading a lot of reviews saying that this is the best 'game soundtrack' and I figured that I'd write a review to disagree a bit. This in my opinino is Yasunori Mitsuda's ultimate masterpiece. The music is timeless and I'm been listening to it for years now and its beauty simply refuses to fade.The price tag on this is pretty staggering I must say, but if you are going to buy any cd for this much money, this is the only one that I feel would be worth every penny.",__label__2