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
#!/bin/bash | |
# sudo apt-get install poppler-utils | |
for n in *.pdf; do echo $n; pdftotext "$n"; done |
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
# Färger (HEX) för de svenska politiska partierna. | |
PartyColor <- list(V = "#DA291C", | |
S = "#E8112d", | |
MP = "#83CF39", | |
C = "#009933", | |
FP = "#006AB3", | |
L = "#006AB3", | |
M = "#52BDEC", | |
KD = "#000077", |
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
# Install R kernel for Jupyter Notebooks, run this via R/RStudio | |
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest')) | |
devtools::install_github('IRkernel/IRkernel') | |
IRkernel::installspec() |
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
#!/usr/bin/bash | |
find . -name 'Kommentarer.txt' -print0 | xargs -0 grep "Betyg: VG" | wc -l |
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
å - \aa | |
ä - \"{a} | |
ö - \"{o} | |
Å - \AA | |
Ä - \"{A} | |
Ö - \"{O} |
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
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; | |
UPDATE mysql.user | |
SET authentication_string = PASSWORD('root'), password_expired = 'N' | |
WHERE User = 'root' AND Host = '%'; | |
FLUSH PRIVILEGES; |
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
# r till d | |
rlist <- seq(0, 1, by=0.01) | |
dlist <- list() | |
i <- 0 | |
for (r in rlist) { | |
i <- i + 1 | |
dlist[i] <- sqrt(4 * r ^ 2) / (1 - r ^ 2) | |
} | |
dlist <- unlist(dlist) |
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
# Calculate margin of error from proportion, and return confidence interval. | |
# p = proportion (0-1) | |
# n = total sample size | |
# z = z score (defaults to 1.96 = 95 % confidence interval) | |
# digits = number of decimal places to be used (defaults to 2) | |
moe <- function(p, n, z=1.96, digits=2) { | |
if(p > 1) { stop("p must be a proportion. For example, for 30 % use p = 0.30") } | |
error <- z * (sqrt(p * (1 - p) / n)) * 100 # Calculate margin of error. | |
conf.level <- round(100 - (pnorm(z, lower.tail=FALSE) * 2) * 100, 0) # Convert z to confidence level (two-tailed). |
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
@echo off | |
REM Resize to 30 % and compress to 65 all JPG files in current directory into new names. | |
for %%f in (*.jpg) do ( | |
echo %%f - %%~nf-new.jpg | |
magick "%%f" -quality 65 -resize 30%% "%%~nf-new.jpg" | |
) |
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
library(ggplot2) | |
library(magick) | |
# --- Extrapolera --- | |
setwd("~/GU/code/rcode") | |
df <- na.exclude(polls.sd) # polls.sd kommer från Polls.r | |
# Skapa modell. |