Skip to content

Instantly share code, notes, and snippets.

View fernandomayer's full-sized avatar

Fernando Mayer fernandomayer

View GitHub Profile
@benilton
benilton / CMR.R
Created July 17, 2011 23:06
Codigo minimo reproduzivel em R
## Este exemplo provê um código em R que outros usuários podem reproduzir
## para facilitar a solução de problemas observados.
##
## Na R-br em: http://r-br.2285057.n4.nabble.com/R-br-Produzindo-um-Codigo-Minimo-Reproduzivel-CMR-td3674188.html
#################################################################
## PASSO 1: Carregue os pacotes necessários no início do código
#################################################################
library(splines)
@defunkt
defunkt / gitio
Created September 11, 2011 08:11
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
anonymous
anonymous / gist:4365081
Created December 23, 2012 18:26
On Friday, 12/21/2012, The American Statistician published a paper by Stavros Kourouklis in which he proposed a new correction factor for estimating the standard deviation of a distribution based on a finite sample. The article describes the surprisingly simple formula for calculating the correction term and provides a proof that this formula at…
n_sims = 1_000_000
mle_se = zeros(n_sims)
unbiased_se = zeros(n_sims)
yatracos_std_se = zeros(n_sims)
kourouklis_std_se = zeros(n_sims)
for sim in 1:n_sims
n = 10
x = randn(n)
@steinwaywhw
steinwaywhw / One Liner to Download the Latest Release from Github Repo.md
Last active July 2, 2024 16:16
One Liner to Download the Latest Release from Github Repo
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@lgatto
lgatto / rnw2rmd.pl
Last active December 18, 2023 05:03
Convert Rnw to Rmd
#!/usr/bin/perl
## Based on convert.txt by Mike Love
## https://gist.github.com/mikelove/5618f935ace6e389d3fbac03224860cd
## The script ignores labels and references, un-numbered sections
## (section*), quotes and probably a couple of more. It won't deal
## with the pre-amble, bibliography and document tags either. Still
## useful, though.
@andrebrait
andrebrait / keychron_linux.md
Last active June 26, 2024 03:35
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@hadley
hadley / loop.R
Last active November 10, 2022 20:11
f1 <- function(n) {
x <- numeric()
for (i in 1:n) {
x <- c(x, i)
}
x
}
f1.5 <- function(n) {
x <- numeric()