A CSV data file with dates for the Jewish holidays of Rosh Hashanah and Yom Kippur from 1900 to 2020.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://twitter.com/jamestanton/status/438258919413387264 | |
-- "111 is divisible by 3. 111111111 is divisible by 9. | |
-- For which N is the number composed of N 1s divisible by N?" | |
-- Version 1: very slow due to the construction of the numerator | |
numerator1 x = sum $ map (\y -> 10^y) [0..(x-1)] | |
test1 x = numerator1 x `rem` x == 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def str2hex (x): | |
return x.encode('hex') | |
def hex2str (x): | |
return x.decode('hex') | |
def str2int (x): | |
return map(ord, x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Title | index.html</title> | |
<script> | |
function showImg(x) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example: Easily source a Gist from R using devtools | |
# 1) install devtools | |
if (!("devtools" %in% installed.packages()[, 1])) { | |
install.packages("devtools") | |
} | |
# 2) source | |
# library(devtools) | |
# source_gist("https://gist.github.com/4041561") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "Machine epsilon gives an upper bound on the relative | |
# error due to rounding in floating point arithmetic." | |
# http://en.wikipedia.org/wiki/Machine_epsilon | |
# ?.Machine | |
.Machine$double.eps | |
# [1] 2.220446e-16 | |
# 2 ^ (-52) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract the hexadecimal color values for a particular palette from | |
# the RColorBrewer package, as used by ggplot's scales package. | |
library("RColorBrewer") | |
brewer.pal(12, "Paired") | |
# [1] "#A6CEE3" "#1F78B4" "#B2DF8A" "#33A02C" "#FB9A99" "#E31A1C" | |
# [7] "#FDBF6F" "#FF7F00" "#CAB2D6" "#6A3D9A" "#FFFF99" "#B15928" |