Skip to content

Instantly share code, notes, and snippets.

@onnyyonn
onnyyonn / Catalan
Last active December 14, 2015 21:19
Print up to 34th Catalan no.
#include <stdio.h>
int main()
{
float n=0.0, cat=1.0;
while(n<=33)
{
cat = 2*(2*n+1)/(n+2)*cat;
n++;
printf("Catalan no. %2.0f is %1.0f\n",n,cat);
@onnyyonn
onnyyonn / Cdoku
Last active October 18, 2016 07:32
A brute force algorithm for solving Sudoku, written in C.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
int prob_sudoku[9][9],empty_cell_not[9][9],prob_len,rowcheck=1,columncheck=1,boxcheck=1,going_back_flag=1,repeat,i,j,k,l;
char problem[100];
/*INPUT*/
@onnyyonn
onnyyonn / mmk_test.py
Last active August 29, 2015 16:35
Performs the Modified Mann-Kendall test to check if there is any trend present. Modified to account for autocorrelation (Hamed and Rao 1998)
from __future__ import division
import numpy as np
from scipy import stats
def mmk_test(v, alpha = 0.05):
"""
Performs the Modified Mann-Kendall test to check if there is any trend present.
Based on Mann-Kendall test code by Sat Kumar Tomer. Modified to account for autocorrelation (Hamed and Rao 1998)
Input:
Verifying my Blockstack ID is secured with the address 1KFSD2uC9GE9pVZL97cpDNvzUjTHZXXR3K https://explorer.blockstack.org/address/1KFSD2uC9GE9pVZL97cpDNvzUjTHZXXR3K
### Keybase proof
I hereby claim:
* I am onnyyonn on github.
* I am anamitra (https://keybase.io/anamitra) on keybase.
* I have a public key ASB16eMLCTYZzbmzoGU96qzJsxj6j7XSR9qJ-njEU3GnWwo
To claim this, I am signing this object:
@onnyyonn
onnyyonn / firefox.md
Last active October 27, 2019 18:40
Firefox new tab dark background with no white splash
  • Go to about:config, change browser.display.background_color value to #000000 and toolkit.legacyUserProfileCustomizations.stylesheets value to true
  • Open profile folder in about:profiles under “Root Directory”
  • go to / create chrome subfolder, open / create userChrome.css and append the following lines: #browser vbox#appcontent tabbrowser, #content, #tabbrowser-tabpanels, browser[type=content-primary], browser[type=content] > html { background: var(--in-content-page-background)!important }
@onnyyonn
onnyyonn / hoon1.hoon
Created April 22, 2020 06:44
Hoonschool assignments
|= i=@
`@ub`i
@onnyyonn
onnyyonn / quantile_bias_correction.py
Created December 29, 2021 07:40
Quantile Bias Correction with Empirical CDF
import numpy as np
from statsmodels.distributions.empirical_distribution import ECDF
def bias_correct(obs_data_train, model_data_train, model_data_test):
"""
Function for bias correcting model_data_test, based on obs_data_train and madel_data_train CDF.
All three should be numpy array. Can be multi-dimensional.
obs_data_train = observation / ground truth
@onnyyonn
onnyyonn / wordle_full.csv
Last active January 14, 2022 01:37
List of Wordle-eligible words
aahed
aalii
aargh
aarti
abaca
abaci
aback
abacs
abaft
@onnyyonn
onnyyonn / wordfreqgen.py
Last active January 16, 2022 07:33
Sample script to generate freqencies of a list of words from Google Ngram Viewer
# Sample script to generate freqencies of a list of words from Google Ngram Viewer
import pandas as pd, numpy as np
import re, requests
from ast import literal_eval
# Import list of words
df = pd.read_csv("wordle_full.csv")
df.rename( columns={'Unnamed: 0':'word', 'Unnamed: 1':'frequency'}, inplace=True )