Skip to content

Instantly share code, notes, and snippets.

@Nxtra
Nxtra / delete-all-models.py
Created January 17, 2020 07:38
Delete all sagemaker models
import boto3
from pprint import pprint
client = boto3.client('sagemaker')
def main():
model_names = []
for key in paginate(client.list_models):
from math import sin
import sdcardio
import storage
import audiobusio
import audiocore
import audiomixer
import audiomp3
import board
import time
import math
@ricardodantas
ricardodantas / validacao+mascara.js
Last active May 9, 2024 00:46
Máscara e validação de RG, CNPJ, CPF, etc...
// JavaScript Document
// adiciona mascara para rg
// Cada estado têm regras e quantidades diferentes de números no registro. Por isso,
// não há uma maneira confiável de fazer a validação do mesmo.
function MascaraRg(v0,errChar='?'){
const v = v0.toUpperCase().replace(/[^\dX]/g,'');
return (v.length==8 || v.length==9)?
v.replace(/^(\d{1,2})(\d{3})(\d{3})([\dX])$/,'$1.$2.$3-$4'):
(errChar+v0)
@mblondel
mblondel / statistical_tests.py
Last active May 9, 2024 00:46
t-test and wilcoxon-test examples in Python
# Mathieu Blondel, February 2012
# License: BSD 3 clause
# Port to Python of examples in chapter 5 of
# "Introductory Statistics with R" by Peter Dalgaard
import numpy as np
from scipy.stats import ttest_1samp, wilcoxon, ttest_ind, mannwhitneyu
# daily intake of energy in kJ for 11 women
@laloe74
laloe74 / hamster.yaml
Last active May 9, 2024 00:46
仓输入法 微信键盘布局+配色
# 仓输入法
#「微信键盘配色」+ 「微信键盘布局」
# 可以导入在线定义平台,按需求修改 <https://lost-melody.github.io/hamster-tools/>
#
# 完整方案 <https://github.com/laloe74/rime-settings>
#
# Bug
# 黑暗模式中,如果背景是大面积白色(例如在窗口中登录谷歌账号),「字母按键背景」将和「键盘背景」几乎同色,不易区分。
# 要解决以上问题,需将「键盘背景」设为不透明,但又会使得「键盘背景」和「键盘底部条」有色差,视觉效果不统一。
# 目前是将「键盘背景」设为透明,这样大部分场景视觉效果较好。
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 9, 2024 00:45
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@gadenbuie
gadenbuie / render_toc.R
Last active May 9, 2024 00:45
Generate Manual Table of Contents in (R)Markdown Documents
#' Render Table of Contents
#'
#' A simple function to extract headers from an RMarkdown or Markdown document
#' and build a table of contents. Returns a markdown list with links to the
#' headers using
#' [pandoc header identifiers](http://pandoc.org/MANUAL.html#header-identifiers).
#'
#' WARNING: This function only works with hash-tag headers.
#'
#' Because this function returns only the markdown list, the header for the
@qxj
qxj / hypothesis.py
Created April 7, 2020 04:13
t test, sign test, wilcoxon signed rank test, and 0/1 distribution test.
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
t test, sign test, wilcoxon signed rank test, and 0/1 distribution test.
"""
import numpy as np
from scipy.special import comb
from scipy.stats import norm
from scipy.stats import t
@realvjy
realvjy / ChoasLinesShader.metal
Last active May 9, 2024 00:42
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@granoeste
granoeste / MainActivity.java
Created August 29, 2012 08:13
[Android] Service Bind/Unbind
public class MainActivity extends Activity {
private static final String TAG = MainActivity.class.getSimpleName();
private final MainActivity self = this;
MainService mService;
MyServiceConnection mConn;
boolean mIsBound;
@Override
public void onCreate(Bundle savedInstanceState) {