Compare commits
47 Commits
3b3d7ade33
...
master
Author | SHA1 | Date | |
---|---|---|---|
c74b861442
|
|||
599ccd2881
|
|||
b191a9e5d4
|
|||
e98d4ffbac
|
|||
f067b0200b
|
|||
e2814b08e1 | |||
2f33669330
|
|||
cee27356f6
|
|||
f358103f79
|
|||
4c51ade750
|
|||
0d2d466dac
|
|||
8cc2a71235
|
|||
fa026b7eda
|
|||
7bc84ab8a3
|
|||
e59538a3bd
|
|||
a9f7fd7f75
|
|||
3adc7ce3a7
|
|||
131e9a1c3f
|
|||
|
44871e36ff | ||
3e18d8c601
|
|||
a0ed5ba301 | |||
3e2c1c1a21
|
|||
45855fdf31
|
|||
11d8c3366f
|
|||
fa64353509
|
|||
1765075c2b
|
|||
dd6b0a279d
|
|||
838eef92c4
|
|||
69062673c9 | |||
fb6f971336
|
|||
0ddefe1fbe | |||
6d486cf94d
|
|||
b1df5e2b57
|
|||
c678ded947
|
|||
60f9de7425
|
|||
b86dfb4e67 | |||
ffda076ee8
|
|||
1a90265daf
|
|||
9b23c29735
|
|||
1e94c730e0 | |||
2f30221da3
|
|||
b1cee86b4c
|
|||
b60bd5d631
|
|||
51dbe77dee
|
|||
7357bdcca0
|
|||
5efe5810a9
|
|||
22712060f7
|
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
||||
*.pdf
|
||||
*.epub
|
||||
Makefile
|
||||
*.xcf
|
||||
|
19
Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
help: ## Print the help message
|
||||
$(info Make a single pdf by hitting the tab key a lot)
|
||||
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
|
||||
sort | \
|
||||
column -s ':' -t
|
||||
|
||||
# Search should not include slides separated by '***', as those are for mdp, not pandoc.
|
||||
markdown != find slides/ -maxdepth 2 -type f -name "*.md" -exec grep -LF '***' '{}' ';'
|
||||
pdfs = $(patsubst %.md, %.pdf, $(markdown))
|
||||
|
||||
$(pdfs): %.pdf: %.md
|
||||
pandoc -t beamer -V theme:Warsaw -i $< -o $@
|
||||
|
||||
.PHONY: pdfs
|
||||
pdfs: $(pdfs) ## Generate all pdfs (try `make -j pdfs`)
|
||||
|
||||
.PHONY: clean
|
||||
clean: ## Delete all pdfs
|
||||
$(RM) $(pdfs)
|
19
README.md
@@ -1,5 +1,20 @@
|
||||
# Radionice
|
||||
|
||||
First run ./configure to generate a Makefile using folders in this directory
|
||||
Usage: `make`
|
||||
|
||||
## Dependecies:
|
||||
|
||||
### For Debian:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install pandoc
|
||||
sudo apt install tikzit
|
||||
```
|
||||
|
||||
### For Arch:
|
||||
|
||||
```bash
|
||||
pacman -Sy pandoc texlive-binextra texlive-pictures texlive-latexrecommended texlive-fontsrecommended
|
||||
```
|
||||
|
||||
Then you can run make to generate pdf beamer slides
|
||||
|
13
configure
vendored
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
FOLDERS=$(cd slides/ ; echo *)
|
||||
|
||||
rm -f Makefile
|
||||
echo -n 'all:' >> Makefile
|
||||
for i in $FOLDERS ; do echo -n " $i.pdf" >> Makefile ; done
|
||||
echo "" >> Makefile
|
||||
|
||||
for i in $FOLDERS ; do echo -e "$i.pdf:\n\tpandoc -t beamer -V theme:Warsaw -i slides/$i/$i.md -o slides/$i/$i.pdf\n" >> Makefile ; done
|
||||
|
||||
echo -ne "clean:\n\trm -f" >> Makefile
|
||||
for i in $FOLDERS; do echo -n " slides/$i/$i.pdf" >> Makefile ; done
|
||||
echo "" >> Makefile
|
65
slides/algebragrupe/algebragrupe.md
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title:
|
||||
- Algebra (Grupe)
|
||||
|
||||
theme:
|
||||
- Warsaw
|
||||
colortheme:
|
||||
- orchid
|
||||
---
|
||||
|
||||
# Uvod
|
||||
- Skupovi
|
||||
- Celi brojevi (beskonacni)
|
||||
- Ostatci pre deljenju (konacne)
|
||||
- Operacije
|
||||
- mnozenje (binarna)
|
||||
- negacija (unarna)
|
||||
|
||||
# Grupe
|
||||
- Rezlutat ostaje unutar skupa
|
||||
- Neutral
|
||||
- Inverz
|
||||
- Asocijativnost
|
||||
- Abelove grupe (komutativnost)
|
||||
- Ciklicne grupe (ostatak pri deljenju)
|
||||
|
||||
# Podgrupe
|
||||
- Celi/Racionalni brojevi
|
||||
- Red grupe
|
||||
- Red podgrupe deli red grupe
|
||||
|
||||
# Kriptografija
|
||||
- Skup poruka m odredjene velicine
|
||||
- Operacija sifrovanja/potpisivanja $\oplus$
|
||||
- jednosmerna (kao i hash funkcije)
|
||||
- Neutral (e)
|
||||
- Inverz kljuceva (k1, k2)
|
||||
- $k1 \oplus k2 \equiv e$
|
||||
- Sifrovanje/Potpisivanje ( $c \equiv m \oplus k1$ )
|
||||
- Desifovanje/Provera ( $c \oplus k2 \equiv m$ )
|
||||
- Asocijativnost
|
||||
- $c \oplus k2 \equiv (m \oplus k1) \oplus k2 \equiv m \oplus (k1 \oplus k2)$
|
||||
- $m \oplus (e) \equiv m$
|
||||
|
||||
# Kljucevi
|
||||
- Jedan kljuc (simetricna)
|
||||
- $k1 \equiv k2$
|
||||
- $1 \oplus 1 \equiv 0 \mod 2$ (komplement)
|
||||
- Dva kljuca (asimetricna)
|
||||
- $2+3 \equiv 0 \mod 5$
|
||||
|
||||
# Razmena kljuceva
|
||||

|
||||
|
||||
# Razmena kljuceva
|
||||
- Diffie–Hellman (DH)
|
||||
- parametri (g,n,...)
|
||||
- Abelova grupa (komutativnost)
|
||||
- $g \oplus a \oplus b \equiv g \oplus b \oplus a$
|
||||
- $(g \oplus a) \oplus b \equiv (g \oplus b) \oplus a$
|
||||
- $A \oplus b \equiv B \oplus a$
|
||||
|
||||
# Sifrovanje/Potpisivanje
|
||||
- Direktno sifrovanje (RSA)
|
||||
- DH + simetcina = asimetricna (EC)
|
4
slides/collectivesecurity/collectivesecurity.md
Normal file
@@ -0,0 +1,4 @@
|
||||
In this talk we will talk about privacy and security issues of using centralized social media platforms and proprietary software.
|
||||
I will talk about the network effect, the fact that social networks (and use of other software) are more useful if more people use it. It is necessary to grow the number of users of these technologies before any individual can enjoy the benefits of this software.
|
||||
We, as an open source community, need to actively organize people to collectively start using decentralized and free and open source software. Creating local groups (hackerspaces) and events that will bring people together and use decentralized applications as main means of communication is the easiest way to give the users an immediate benefit of using these technologies.
|
||||
I will mention some decentralized apps like Matrix,XMPP and Mastodon, and emphasize the importance of installing these apps even if we don't need to immediately have use for them.
|
1
slides/collectivesecurity/desc.txt
Normal file
@@ -0,0 +1 @@
|
||||
Digital privacy and cyber security is often presented as individual issues that we can solve on our own. In this talk we will talk about necessity of fixing these problems collectively and required steps we need to take. We don't need to switch to more secure ways of communicating right away, but we need to use secure alternatives in addition to insecure technologies in order to allow others to make a switch.
|
BIN
slides/collectivesecurity/mandatoryconviniece.png
Normal file
After Width: | Height: | Size: 1.3 MiB |
77
slides/death_shards/death_shards.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Sharding Passwords to Share before Death
|
||||
|
||||
<!--
|
||||
- ожалошћена Породица
|
||||
- family in mourning
|
||||
-->
|
||||
|
||||
> Death approaches
|
||||
|
||||
# Software Problems Require Software Solutions
|
||||
|
||||
- `ssss` will shard anything up to 1024 bits.
|
||||
- `encfs` or similar required for a folder.
|
||||
|
||||
```bash
|
||||
fortune | ssss-split -t 3 -n 5 > shards.txt
|
||||
head -n 3 shards.txt | ssss-combine -t 3
|
||||
```
|
||||
|
||||
# Interface
|
||||
|
||||
- Electron?
|
||||
- 3 actions:
|
||||
* 'How many people do you trust?'
|
||||
* 'How much do you trust them?'
|
||||
* *Lock* / *Unlock* icon
|
||||
|
||||
# Requirements
|
||||
|
||||
- `<25MiB` for email
|
||||
* So no electron.
|
||||
|
||||
# The Social Sphere
|
||||
|
||||
- Suggested receivers
|
||||
- Email templates may help?
|
||||
|
||||
# The Antisocial Sphere
|
||||
|
||||
- Flesh protocols are tricky.
|
||||
|
||||

|
||||
|
||||
# Email Templates
|
||||
|
||||
## Be casual!
|
||||
|
||||
> Hi Alice,
|
||||
>
|
||||
> Can you take this to my funeral, but not now - just put it somewhere.
|
||||
> It's just for this thing, anyway...
|
||||
> K thx bye!
|
||||
> xx bob
|
||||
|
||||
# Email Templates
|
||||
|
||||
## Be Formal
|
||||
|
||||
> Dearest Bob,
|
||||
>
|
||||
> Please find contained herein, one of my 'Death Shards'. It is of utmost importance that you maintain the consistency and secrecy of this file. This shard of death shall - within the fullness of time - alleviate the potential necessity of interacting with every part - financial, social, and unwholesome - which I have, heretofore, interacted with, insofar as the [now] modern electronic landscape has been concerned.
|
||||
>
|
||||
> Yours, ...for now.
|
||||
> Alice.
|
||||
|
||||
# Notes
|
||||
|
||||
## Other Methods
|
||||
|
||||
Is this all wrong?
|
||||
Perhaps it should be a standard function within 1pass.
|
||||
|
||||
## MFA is a Nightmare
|
||||
|
||||
- The project should probably include a request for a phone password.
|
||||
- Will this update?
|
||||
- Nudes?
|
BIN
slides/death_shards/family.jpg
Normal file
After Width: | Height: | Size: 131 KiB |
54
slides/dns/dns.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# DNS
|
||||
|
||||
# Internet
|
||||
|
||||
- Potrebna je IP adresa (teske za pamcenje, menjaju se)
|
||||
|
||||
- Domeni su citljivi i lako pamptljivi
|
||||
|
||||
- Jedan domen moze da pokazuje na vise IP adresa
|
||||
|
||||
- Dodatne informacije o sajtu/servisu
|
||||
|
||||
# Domeni
|
||||
|
||||
- Par servera sadrzi listu top level domena (com,org,rs,...)
|
||||
|
||||
- Kompanije/organizacije/institucije kontrolisu TLD
|
||||
|
||||
- Domeni mogu imati mnogo subdomena (www.dmz.rs, forum.dmz.rs)
|
||||
|
||||
- Domain registri zakupljuju domene na racun korisnika
|
||||
|
||||
- Svaki subdomen moze imati vise i bilo koju vrstu recorda
|
||||
|
||||
# Uloge
|
||||
|
||||
- Klijent, resolver, name server
|
||||
|
||||
- Klijent moze da trazi IP adresu od resolvera
|
||||
|
||||
- Resolver trazi odgovorni name server za taj domen (rs, dmz.rs, www.dmz.rs)
|
||||
|
||||
- Time to live (TTL) bira nameserver
|
||||
|
||||
- Klijenti koriste vise resolvera, resolveri vise name servera
|
||||
|
||||
- Primary i secondary resolver
|
||||
|
||||
- Master i slave name serveri
|
||||
|
||||
# Vrste zapisa/rekorda
|
||||
|
||||
- A rekord (IPv4 adresa)
|
||||
|
||||
- AAAA (IPv6 adresa)
|
||||
|
||||
- CNAME (drugi/alternativni domen)
|
||||
|
||||
- NS (nameserveri odgovorni za domen)
|
||||
|
||||
- MX (domen/IP email servera)
|
||||
|
||||
- TXT (tekst)
|
||||
|
103
slides/ekonomija/ekonomija.md
Normal file
@@ -0,0 +1,103 @@
|
||||
---
|
||||
title:
|
||||
- Uvod u ekonomiju
|
||||
|
||||
theme:
|
||||
- Warsaw
|
||||
colortheme:
|
||||
- orchid
|
||||
---
|
||||
|
||||
# Uvod
|
||||
- Šta je ekonomija?
|
||||
- istorija
|
||||
- trampa
|
||||
- kovanice i papirni novac
|
||||
- "slobodna" trgovina
|
||||
- raspodela resursa
|
||||
- efikasnost i evektivnost
|
||||
|
||||
|
||||
# Uvod
|
||||
- Šta je novac?
|
||||
- banke
|
||||
- ponuda i traznja
|
||||
- moć odlučivanja u raspodeli resursa
|
||||
- likvidnost
|
||||
- bruto domaci proizvod (BDP eng GDP)
|
||||
|
||||
# Štednja
|
||||
- Štednja
|
||||
- inflacija
|
||||
- valuta
|
||||
- investicija
|
||||
- oročenje
|
||||
|
||||
# Krediti
|
||||
- Krediti
|
||||
- inflacija
|
||||
- valuta
|
||||
- investicija
|
||||
- kamata
|
||||
|
||||
# Akcije
|
||||
- Hartije of vrednosti (HOV)
|
||||
- akcije
|
||||
- obveznice
|
||||
- indeksi
|
||||
|
||||
# Berza
|
||||
- Berze
|
||||
- belex
|
||||
- strane
|
||||
|
||||
# Brokeri
|
||||
- Brokeri
|
||||
- domaći
|
||||
- strani
|
||||
- wall street
|
||||
|
||||
# Kripto
|
||||
- Novac
|
||||
- monetarna politka
|
||||
- brzina transakcije
|
||||
- provizije transakcije
|
||||
- likvidnost
|
||||
- shitcoins
|
||||
|
||||
# Kripto
|
||||
- Trgovina
|
||||
- menjačnice
|
||||
- iluzija sposobnosti
|
||||
- zakoni
|
||||
|
||||
# Uspesi sistema
|
||||
- Uspesi sistema
|
||||
- brz napredak u poljima interesovanja (profita)
|
||||
- masovna proizvodnja
|
||||
- poslovi i obucavanje naroda
|
||||
-
|
||||
|
||||
# Neuspesi i kritika sistema
|
||||
- Kritika
|
||||
- planirano zastarevanje
|
||||
- ciklicna potrosnja
|
||||
- ekoloska katastrofa
|
||||
- automatizacija
|
||||
- besmisleni poslovi
|
||||
- robovanje profitu
|
||||
- kompetitivnost i ratovi
|
||||
- sve na prodaju
|
||||
- kriza u ciklusima
|
||||
- najbogatijih 1%
|
||||
- maltuzianizm
|
||||
|
||||
|
||||
# Kako da se obogatim?
|
||||
- Kako zaraditi?
|
||||
- nasledstvo
|
||||
- rad i štednja
|
||||
- investicije
|
||||
- kradja
|
||||
- sreća
|
||||
|
62
slides/extended_minds/extended_minds.md
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title:
|
||||
- The Extended Mind and Licensing
|
||||
author:
|
||||
- Malin
|
||||
|
||||
theme:
|
||||
- Warsaw
|
||||
colortheme:
|
||||
- orchid
|
||||
---
|
||||
|
||||
# History
|
||||
|
||||
- Started with Clark and Chalmers
|
||||
- [Chalmers at Ted](https://yt.artemislena.eu/watch?v=ksasPjrYFTg)
|
||||
|
||||
## Cyborg Manifesto
|
||||
|
||||
Or maybe Donna Haraway?
|
||||
|
||||
# Original Extended Minds
|
||||
|
||||
- Notebooks
|
||||
- Counting on fingers
|
||||
- Fil-o-fax
|
||||
|
||||
# Electronic Extended Minds
|
||||
|
||||
- Phones
|
||||
- Computers
|
||||
- Google?
|
||||
- Note-apps?
|
||||
|
||||
# Intuition Pumps
|
||||
|
||||
- Proprioception and teeth
|
||||
- The feeling of loss over theft
|
||||
- Second brains
|
||||
|
||||
# Requirements
|
||||
|
||||
- 'to-hand'
|
||||
- Repetition
|
||||
- Locus
|
||||
|
||||
> Do you know where they live?
|
||||
|
||||
# Counter Requirements
|
||||
|
||||
> Skin and bone
|
||||
|
||||
Does *Ghost in the Shell* count?
|
||||
|
||||
# The Point and the Future
|
||||
|
||||

|
||||
|
||||
# End Notes
|
||||
|
||||
> Can you code in the sand?
|
||||
|
BIN
slides/extended_minds/robocop_values.png
Normal file
After Width: | Height: | Size: 358 KiB |
243
slides/joyous_bash/joyous_bash.md
Normal file
@@ -0,0 +1,243 @@
|
||||
# Shut Up!
|
||||
|
||||
|
||||
|
||||
```sh
|
||||
echo blacklist pcspkr > /etc/modprobe.d/nobeep.conf
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Standard Visuals
|
||||
|
||||
- `cbonsai`
|
||||
- `asciiquarium`
|
||||
- `top`
|
||||
* `ZH4W`
|
||||
|
||||
## Another Monday!
|
||||
|
||||
- `cal --reform julian`
|
||||
|
||||
## Weather
|
||||
|
||||
```sh
|
||||
curl wttr.in
|
||||
curl -s wttr.in/Београд
|
||||
curl wttr.in/Moon
|
||||
```
|
||||
|
||||
# `ls`
|
||||
|
||||
`ls -X`
|
||||
|
||||
---
|
||||
|
||||
# vim
|
||||
|
||||
- blog!
|
||||
- seriously, just write
|
||||
|
||||
---
|
||||
|
||||
# `watch`
|
||||
|
||||
## Watch Differences
|
||||
|
||||
- `watch -d stat "$file"`
|
||||
- `watch -d ip a`
|
||||
|
||||
## With Makefiles
|
||||
|
||||
```sh
|
||||
watch --chgexit ping -c 1 dmz.rs && sleep 3 && unison -batch pir
|
||||
```
|
||||
|
||||
## Check Progress
|
||||
|
||||
```sh
|
||||
watch 'ls **/*.pdf | column'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Watch Shell Scripts
|
||||
|
||||
|
||||
```sh
|
||||
watch -e ./script.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Slow Down
|
||||
|
||||
```sh
|
||||
function slow(){
|
||||
ff=/tmp/bashpipe_$(date +%s)
|
||||
mkfifo $ff 2>/dev/null
|
||||
( cat $ff | perl -We 'use Time::HiRes;$|++;while(read(STDIN,$c,1)){Time::HiRes::usleep(15000);print $c;}' )& exec &> $ff
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Safety?
|
||||
|
||||
- no
|
||||
|
||||
## `htop`?
|
||||
|
||||
- no
|
||||
|
||||
## `speedtest`?
|
||||
|
||||
- **YES**
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Notes
|
||||
|
||||
```sh
|
||||
alias no='$EDITOR .no.md'
|
||||
function n(){
|
||||
[ -z "$1" ] && cat .no.md || echo $@ >> .no.md
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# URL Decoding
|
||||
|
||||
|
||||
```bash
|
||||
urldecode(){ : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Send Text
|
||||
|
||||
|
||||
```sh
|
||||
function sendtext(){
|
||||
[ -f "$1" ] && \
|
||||
cat "$1" | nc termbin.com 9999 || \
|
||||
echo "$($1)" | nc termbin.com 9999
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Readline
|
||||
|
||||
|
||||
Put this in `.inputrc`.
|
||||
|
||||
```text
|
||||
set editing-mode vi
|
||||
set keymap vi
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# More Readline vi
|
||||
|
||||
|
||||
```text
|
||||
set editing-mode vi
|
||||
set show-mode-in-prompt on
|
||||
set vi-ins-mode-string " "
|
||||
set vi-cmd-mode-string " "
|
||||
set keymap vi
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# More Readline
|
||||
|
||||
```text
|
||||
|
||||
set match-hidden-files off
|
||||
set show-all-if-ambiguous on
|
||||
set show-all-if-unmodified on
|
||||
set colored-stats on
|
||||
|
||||
"\C- ": shell-expand-line
|
||||
"\C-x": glob-expand-word
|
||||
Control-g: "g\n"
|
||||
Control-y: "| ccze\n"
|
||||
Control-o: "\C-u lfcd\n\C-u"
|
||||
Control-l: "\C-u clear -x && ls\n"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Synchronization
|
||||
|
||||
## Syncthing
|
||||
|
||||
- 'Just works'
|
||||
|
||||
## Unison
|
||||
|
||||
- Fuck haskell
|
||||
- But actually it's good
|
||||
|
||||
|
||||
---
|
||||
|
||||
# `column`
|
||||
|
||||
```sh
|
||||
column -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd
|
||||
```
|
||||
|
||||
##
|
||||
|
||||
```sh
|
||||
column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd | jq -r .table.[].user
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# Aliases
|
||||
|
||||
## b
|
||||
|
||||
```sh
|
||||
b ()
|
||||
{
|
||||
eval "cd $(for d in $(seq 1 $1);
|
||||
do
|
||||
printf ../;
|
||||
done)"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
# `eval`
|
||||
|
||||
- Don't
|
||||
|
||||
---
|
||||
|
||||
# Clear Downloads
|
||||
|
||||
```sh
|
||||
rm -rf ~/Downloads/*
|
||||
echo "tmpfs $HOME/Downloads tmpfs defaults,size=1G 0 0" | sudo tee -a /etc/fstab
|
||||
sudo systemctl daemon-reload # Only for systemd
|
||||
sudo mount -a
|
||||
mount | tail -1
|
||||
```
|
||||
|
||||
# The Best: `yes`
|
||||
|
||||
- `yes`
|
||||
- `yes no`
|
||||
|
BIN
slides/lfs/inferno.png
Normal file
After Width: | Height: | Size: 238 KiB |
101
slides/lfs/lfs.md
Normal file
@@ -0,0 +1,101 @@
|
||||
# The Horrifying Cost
|
||||
|
||||
If a Git has 2806 commits, and you commit 15MB worth of output each time, then you are a menace and must be stopped.
|
||||
|
||||
```text
|
||||
|
||||
2806 commits x 15MB = 41GB
|
||||
|
||||
```
|
||||
|
||||
# Initial Tactics: `.gitignore`
|
||||
|
||||
```
|
||||
*.pdf
|
||||
*.epub
|
||||
Makefile
|
||||
*.xcf
|
||||
```
|
||||
|
||||
...but sometimes it's not enough.
|
||||
|
||||
# Saving Your Immortal Soul
|
||||
|
||||

|
||||
|
||||
End the madness with git lfs.
|
||||
|
||||
# Setup
|
||||
|
||||
```bash
|
||||
|
||||
apt install -y git-lfs
|
||||
cd $PROJECT
|
||||
git lfs install
|
||||
```
|
||||
|
||||
## Output: Easy Hooks
|
||||
|
||||
```bash
|
||||
cat ~/.git/hooks/pre-push
|
||||
```
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
command -v git-lfs >/dev/null 2>&1 || { echo >&2
|
||||
"This repository is configured for Git LFS but
|
||||
'git-lfs' was not found on your path. If you no
|
||||
longer wish to use Git LFS, remove this hook by
|
||||
deleting '.git/hooks/pre-push'."; exit 2; }
|
||||
|
||||
|
||||
git lfs pre-push "$@"
|
||||
```
|
||||
|
||||
|
||||
# Add Files
|
||||
|
||||
Track all the files:
|
||||
|
||||
```bash
|
||||
git lfs track "*.iso"
|
||||
git lfs track "*.png"
|
||||
git lfs track "*.jpg"
|
||||
git lfs track "*.jpeg"
|
||||
git lfs track "*.tiff"
|
||||
git lfs track "*.xlsx"
|
||||
git lfs track "*.docx"
|
||||
|
||||
cat .gitattributes
|
||||
```
|
||||
Result:
|
||||
|
||||
```
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.svg filter=lfs diff=lfs merge=lfs -text
|
||||
```
|
||||
|
||||
Double check with `git lfs ls-files`.
|
||||
|
||||
|
||||
# Locking
|
||||
|
||||
[ If your remote supports it ]
|
||||
lock your files when working on them.
|
||||
|
||||
# Migration
|
||||
|
||||
Make sure you have all the files:
|
||||
|
||||
```bash
|
||||
git lfs fetch origin --all
|
||||
|
||||
git lfs push $newRemote --all
|
||||
|
||||
```
|
||||
|
||||
# Problems
|
||||
|
||||
`soft-serve` does not yet support `git-lfs`.
|
||||
|
||||
(end list)
|
119
slides/makefiles/PS/general_make.md
Normal file
@@ -0,0 +1,119 @@
|
||||
# Generalizing Makefiles for All Occasions
|
||||
|
||||
- Rules are bad,
|
||||
- standards are good,
|
||||
- habits are better.
|
||||
|
||||
***
|
||||
|
||||
# General Standards
|
||||
|
||||
- `make help`
|
||||
- `make check`
|
||||
- `sudo make install`
|
||||
|
||||
**NB:** we separate `make` from `make install` so that the files are not build with the user `root` as the owner.
|
||||
|
||||
***
|
||||
|
||||
# Service Standards
|
||||
|
||||
- `make backup.tgz`
|
||||
- `make install`
|
||||
|
||||
## Service Backups in Two Files
|
||||
|
||||
- `configs`: configuration files, all tracked in git.
|
||||
- `store`: passwords and binary files, not tracked in git.
|
||||
|
||||
## New Abilities Unlocked
|
||||
|
||||
- Open Access Administration.
|
||||
- Sharing admin configs with hacker spaces.
|
||||
|
||||
***
|
||||
|
||||
## BEHOLD: The Everything Makefile
|
||||
|
||||
***
|
||||
|
||||
```make
|
||||
CONFIGS = $(patsubst /%,%,$(shell cat configs))
|
||||
STORE = $(patsubst /%,%,$(shell cat store))
|
||||
CP = mkdir -p $(dir $@) && cp -a
|
||||
IGNORE_FILE = $(shell test -d .git/info && echo .git/info/exclude || echo .gitignore)
|
||||
GIT_COMMIT = git commit -m"add $@" --no-gpg-sign --no-signoff
|
||||
SELECTOR != command -v sk || command -v fzy || command -f fzf
|
||||
.PHONY: all
|
||||
all: init backup.tgz $(IGNORE_FILE)
|
||||
backup.tgz: $(CONFIGS) $(STORE)
|
||||
tar czf $@ $^
|
||||
$(IGNORE_FILE): store
|
||||
echo $(STORE) backup.tgz | tr ' ' '\n' > $@
|
||||
.PHONY: init
|
||||
init: configs store
|
||||
configs store:
|
||||
while con="$$(find /var /etc/ /sys/ -maxdepth 2 -mindepth 1 -type f 2>/dev/null | $(SELECTOR) -p "Select files for $@\nPress Ctrl+d once done")"; do \
|
||||
echo "$$con"; \
|
||||
done > $@
|
||||
$(CONFIGS): %: /%
|
||||
$(CP) $< $@
|
||||
git add $@
|
||||
$(GIT_COMMIT)
|
||||
$(info made git commit for $@)
|
||||
$(STORE): %: /%
|
||||
$(CP) $< $@
|
||||
clean:
|
||||
$(RM) -r $(CONFIGS) $(STORE) backup.tgz
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
## Example: Soft Serve Makefile
|
||||
|
||||
<br>
|
||||
The `configs` file:
|
||||
|
||||
```
|
||||
/etc/soft-serve.conf
|
||||
/var/lib/soft-serve/data/config.yaml
|
||||
/var/lib/soft-serve/data/file
|
||||
/etc/nginx/sites-enabled/soft.dmz.rs
|
||||
/etc/nginx/sites-available/soft.dmz.rs
|
||||
```
|
||||
|
||||
<br>
|
||||
The `store` file:
|
||||
|
||||
```
|
||||
/var/lib/soft-serve/data/lfs
|
||||
/var/lib/soft-serve/data/repo
|
||||
/var/lib/soft-serve/data/soft
|
||||
/etc/letsencrypt/archive/soft
|
||||
/etc/letsencrypt/live/soft.dm
|
||||
/var/lib/soft-serve/data/ssh/
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# Other Build Systems
|
||||
|
||||
> "*What if I want to use this other thing, instead of a makefile?"
|
||||
|
||||
***
|
||||
|
||||
# Other Build Systems (Sans Heresy)
|
||||
|
||||
> "*What if I want to use this other thing, instead of a makefile?"
|
||||
|
||||
- Easy: just use a Makefile.
|
||||
|
||||
|
||||
```make
|
||||
|
||||
[ ... ]
|
||||
|
||||
public/: src/
|
||||
python build_pages.py
|
||||
```
|
||||
|
34
slides/makefiles/PS/omni_makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
CONFIGS = $(patsubst /%,%,$(shell cat configs))
|
||||
STORE = $(patsubst /%,%,$(shell cat store))
|
||||
CP = mkdir -p $(dir $@) && cp -a
|
||||
IGNORE_FILE = $(shell test -d .git/info && echo .git/info/exclude || echo .gitignore)
|
||||
GIT_COMMIT = git commit -m"add $@" --no-gpg-sign --no-signoff
|
||||
SELECTOR != command -v sk || command -v fzy || command -f fzf
|
||||
|
||||
.PHONY: all
|
||||
all: init backup.tgz $(IGNORE_FILE)
|
||||
|
||||
backup.tgz: $(CONFIGS) $(STORE)
|
||||
tar czf $@ $^
|
||||
|
||||
$(IGNORE_FILE): store
|
||||
echo $(STORE) backup.tgz | tr ' ' '\n' > $@
|
||||
|
||||
.PHONY: init
|
||||
init: configs store
|
||||
|
||||
configs store:
|
||||
while con="$$(find /var /etc/ /sys/ -maxdepth 2 -mindepth 1 -type f 2>/dev/null | $(SELECTOR) -p "Select files for $@\nPress Ctrl+d once done")"; do \
|
||||
echo "$$con"; \
|
||||
done > $@
|
||||
|
||||
$(CONFIGS): %: /%
|
||||
$(CP) $< $@
|
||||
git add $@
|
||||
$(GIT_COMMIT)
|
||||
$(info made git commit for $@)
|
||||
$(STORE): %: /%
|
||||
$(CP) $< $@
|
||||
|
||||
clean:
|
||||
$(RM) -r $(CONFIGS) $(STORE) backup.tgz
|
1
slides/makefiles/dependency_ladder/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*
|
16
slides/makefiles/dependency_ladder/makes/books
Normal file
@@ -0,0 +1,16 @@
|
||||
MONTHS != date +%B && date -d '1 month' +%B
|
||||
IP != dig +short myip.opendns.com @resolver1.opendns.com
|
||||
CITY != curl -s http://api.db-ip.com/v2/free/$(IP) | grep city | cut -d: -f2 | tr -d '"'
|
||||
|
||||
TITLES = $(MONTHS)
|
||||
TITLES += $(CITY)
|
||||
|
||||
BOOKS = $(patsubst %,Books/%.md,$(TITLES))
|
||||
|
||||
$(BOOKS):
|
||||
@mkdir -p $(@D)
|
||||
fortune -l > $@
|
||||
|
||||
progs += $(BOOKS)
|
||||
|
||||
dross += Books/
|
10
slides/makefiles/dependency_ladder/makes/cows
Normal file
@@ -0,0 +1,10 @@
|
||||
cows = $(patsubst Forts/fortune_%.md,Cows/cow-%.txt,$(wildcard Forts/fortune_*.md))
|
||||
|
||||
$(cows): Cows/cow-%.txt: Forts/fortune_%.md
|
||||
@mkdir -p $(@D)
|
||||
cat $< | cowsay > $@
|
||||
|
||||
progs += forts
|
||||
progs += $(cows)
|
||||
dross += Cows/
|
||||
|
11
slides/makefiles/dependency_ladder/makes/forts
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
fnums != seq 8 | sort -R | head -2
|
||||
forts = $(patsubst %,Forts/fortune_%.md,$(fnums))
|
||||
|
||||
$(forts):
|
||||
@mkdir -p $(@D)
|
||||
fortune -s > $@
|
||||
|
||||
progs += $(forts)
|
||||
|
||||
dross += Forts/
|
14
slides/makefiles/dependency_ladder/makes/zoo
Normal file
@@ -0,0 +1,14 @@
|
||||
filter = $(shell cowsay -l | sort -R | head -1)
|
||||
|
||||
zoo = $(patsubst Forts/fortune_%.md,Zoo/animal-%.md,$(forts))
|
||||
|
||||
$(zoo): Zoo/animal-%.md: Forts/fortune_%.md
|
||||
@mkdir -p $(@D)
|
||||
echo '```' > $@
|
||||
cat $< | cowsay -f $(filter) >> $@
|
||||
echo '```' >> $@
|
||||
|
||||
progs += forts
|
||||
progs += $(zoo)
|
||||
|
||||
dross += Zoo/
|
1
slides/makefiles/examples/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*
|
8
slides/makefiles/examples/check
Normal file
@@ -0,0 +1,8 @@
|
||||
CHECKER = command -v
|
||||
.PHONY: check
|
||||
check:
|
||||
$(CHECKER) fortune >/dev/null
|
||||
$(CHECKER) cowsay >/dev/null
|
||||
|
||||
file: | check
|
||||
fortune | cowsay > $@
|
13
slides/makefiles/examples/fort_1
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
forts/big_fort.txt: forts/short.txt forts/long.txt
|
||||
cat forts/short.txt forts/long.txt > forts/big_fort.txt
|
||||
|
||||
forts/:
|
||||
mkdir forts
|
||||
|
||||
forts/short.txt: forts/
|
||||
fortune -s > forts/short.txt
|
||||
|
||||
forts/long.txt: forts/
|
||||
fortune -l > forts/long.txt
|
||||
|
21
slides/makefiles/examples/fort_2
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
forts/big_fort.txt: forts/short.txt forts/long.txt
|
||||
cat $^ > $@
|
||||
|
||||
README.md:
|
||||
echo "For an example makefile for python" > $@
|
||||
echo "check out the nd6 dice-roller at" >> $@
|
||||
echo "ssh -p 2222 soft.dmz.rs -t nd6" >> $@
|
||||
|
||||
|
||||
forts/: README.md
|
||||
mkdir -p $@
|
||||
|
||||
forts/short.txt: forts/
|
||||
fortune -s > $@
|
||||
|
||||
forts/long.txt: forts/
|
||||
fortune -l > $@
|
||||
|
||||
clean:
|
||||
rm -rf forts
|
1
slides/makefiles/examples/omni_makefile
Symbolic link
@@ -0,0 +1 @@
|
||||
../PS/omni_makefile
|
18
slides/makefiles/examples/pats
Normal file
@@ -0,0 +1,18 @@
|
||||
IMAGES = $(wildcard jpgs/*)
|
||||
COL = $(patsubst jpgs/%,collection/%,$(IMAGES))
|
||||
|
||||
.PHONY: help
|
||||
help:
|
||||
$(info try 'show' or 'output')
|
||||
.PHONY: show
|
||||
show:
|
||||
$(info IMAGES is $(IMAGES))
|
||||
$(info Col is $(COL))
|
||||
|
||||
.PHONY: output
|
||||
output: $(COL)
|
||||
|
||||
collection/%.jpg: jpgs/%.jpg
|
||||
mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
15
slides/makefiles/examples/rules
Normal file
@@ -0,0 +1,15 @@
|
||||
CP = ln -f
|
||||
|
||||
output: pngs/ldap.png
|
||||
|
||||
jpgs/ldap.jpg: ../../ldap/ldap.jpg
|
||||
mkdir -p $(dir $@)
|
||||
$(CP) $< $@
|
||||
|
||||
pngs/%.png: jpgs/%.jpg
|
||||
mkdir -p $(dir $@)
|
||||
$(info making $(@F) in $(@D))
|
||||
magick $< $@
|
||||
|
||||
clean:
|
||||
$(RM) -r pngs jpgs
|
10
slides/makefiles/examples/vars
Normal file
@@ -0,0 +1,10 @@
|
||||
include /etc/os-release
|
||||
DAY != date +%d
|
||||
MESSAGE != fortune -s
|
||||
|
||||
motd_$(DAY):
|
||||
$(info Hello $(USER))
|
||||
$(info Placing message:)
|
||||
echo "Welcome to $(NAME)" > $@
|
||||
echo $(MESSAGE) >> $@
|
||||
|
13
slides/makefiles/makefiles.md
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title:
|
||||
- Making Makefiles
|
||||
author:
|
||||
- Malin
|
||||
|
||||
theme:
|
||||
- Warsaw
|
||||
colortheme:
|
||||
- orchid
|
||||
---
|
||||
|
||||
(presentation in presentation.md)
|
314
slides/makefiles/presentation.md
Normal file
@@ -0,0 +1,314 @@
|
||||
# Intro
|
||||
|
||||
The fundamental problem:
|
||||
|
||||
```bash
|
||||
git submodule update --init soundscape
|
||||
cargo build --release
|
||||
install -pm755 target/release/tap /usr/local/bin/
|
||||
```
|
||||
|
||||
*But you can't type this for each run.*
|
||||
|
||||
***
|
||||
|
||||
## First Solution
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
git submodule update --init soundscape
|
||||
cargo build --release
|
||||
install -pm755 target/release/tap /usr/local/bin/
|
||||
```
|
||||
|
||||
At this point, every test takes 10 minutes.
|
||||
|
||||
## Second Solution
|
||||
|
||||
```bash
|
||||
#!/bin/sh
|
||||
[ -f soundscape/.git ] || git submodule update --init soundscape
|
||||
[ -f target/release/tap ] || cargo build --release
|
||||
[ -f target/release/tap ] || \
|
||||
install -pm755 target/release/tap /usr/local/bin/
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# Makefile Solutions
|
||||
|
||||
- input, process, output.
|
||||
- automatic idempotence
|
||||
|
||||
```bash
|
||||
INSTALL_DIR = /usr/local/bin
|
||||
|
||||
soundscape/.git:
|
||||
git submodule update --init soundscape
|
||||
|
||||
/usr/local/bin/tap: target/release/tap
|
||||
install -pm755 target/release/tap $(INSTALL_DIR)
|
||||
|
||||
target/release/tap: src soundscape/.git
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# The Three Sigils
|
||||
|
||||
Readable, but slow:
|
||||
|
||||
```make fort_1
|
||||
forts/big_fort.txt: forts/short.txt forts/long.txt
|
||||
cat forts/short.txt forts/long.txt > forts/big_fort.txt
|
||||
|
||||
forts/:
|
||||
mkdir forts
|
||||
|
||||
forts/short.txt: forts/
|
||||
fortune -s > forts/short.txt
|
||||
|
||||
forts/long.txt: forts/
|
||||
fortune -l > forts/long.txt
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
| Make this | From That | From These |
|
||||
|:---------:|:---------:|:----------:|
|
||||
| `$@` | `$<` | `$^` |
|
||||
|
||||
|
||||
```make fort_2
|
||||
forts/big_fort.txt: forts/short.txt forts/long.txt
|
||||
cat $^ > $@
|
||||
|
||||
forts/: README.md
|
||||
mkdir $@
|
||||
forts/short.txt: forts/
|
||||
fortune -s > $@
|
||||
forts/long.txt: forts/
|
||||
fortune -l > $@
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# Gotcha: Directories
|
||||
|
||||
|
||||
```make fort_2
|
||||
forts/big_fort.txt: forts/short.txt forts/long.txt
|
||||
cat $^ > $@
|
||||
|
||||
forts/: README.md
|
||||
mkdir $@
|
||||
forts/short.txt: forts/
|
||||
fortune -s > $@
|
||||
forts/long.txt: forts/
|
||||
fortune -l > $@
|
||||
|
||||
README.md:
|
||||
echo "Find the fortunes in the fort dir" > $@
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# Variables
|
||||
|
||||
```make vars
|
||||
include /etc/os-release
|
||||
DAY != date +%d
|
||||
MESSAGE != fortune -s
|
||||
|
||||
motd_$(DAY):
|
||||
$(info Placing message:)
|
||||
echo "Welcome to $(NAME)" > $@
|
||||
echo $(MESSAGE) >> $@
|
||||
```
|
||||
|
||||
### Gotcha: Hanging Quotes
|
||||
|
||||
> echo "Welcome to "Arch Linux""
|
||||
|
||||
***
|
||||
|
||||
## Add New Variables
|
||||
|
||||
```make
|
||||
make -f vars -e MESSAGE="Red alert, all hands on deck!"
|
||||
```
|
||||
|
||||
### Gotcha: Quote, or Risk Escape
|
||||
|
||||
```make
|
||||
make -f vars -e MESSAGE="<h1> HTML Headers </h1>"
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# Gotcha: Variables from Shell
|
||||
|
||||
This works:
|
||||
|
||||
```make
|
||||
file:
|
||||
$(info Hello $(USER))
|
||||
```
|
||||
|
||||
...but not this:
|
||||
|
||||
```make
|
||||
file:
|
||||
user=bob
|
||||
echo $user
|
||||
```
|
||||
|
||||
Nor this:
|
||||
|
||||
```make
|
||||
numbers:
|
||||
for x in 1 2 3 4 5; do
|
||||
echo $x
|
||||
done > $@
|
||||
```
|
||||
|
||||
Nor this:
|
||||
|
||||
```make
|
||||
numbers:
|
||||
for x in 1 2 3 4 5; do echo $x ; done > $@
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
### Ugly Fixes are Ugly
|
||||
|
||||
This works, but don't.
|
||||
|
||||
```make
|
||||
file:
|
||||
for x in 1 2 ;\
|
||||
do echo $$x ;\
|
||||
done > $@
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
|
||||
# Phonies, and the Problems with Lies
|
||||
|
||||
## Clean
|
||||
|
||||
|
||||
```make
|
||||
.PHONY: clean
|
||||
clean:
|
||||
git clean -fdX
|
||||
```
|
||||
|
||||
## Gotcha: Recompiling without Changes
|
||||
|
||||
```make
|
||||
CHECKER = command -v
|
||||
.PHONY: check
|
||||
check:
|
||||
$(CHECKER) fortune >/dev/null
|
||||
$(CHECKER) cowsay >/dev/null
|
||||
|
||||
file: check # Needs a '|'
|
||||
fortune | cowsay > $@
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
|
||||
## Non-Compiling Checks
|
||||
|
||||
- `make` -n
|
||||
- *Gotcha*: shell output variables.
|
||||
|
||||
***
|
||||
|
||||
|
||||
# The Fourth Sigil: `%`
|
||||
|
||||
Create standardized rules with `%`.
|
||||
|
||||
|
||||
```make rules
|
||||
CP = ln -f
|
||||
|
||||
output: pngs/ldap.png
|
||||
|
||||
jpgs/ldap.jpg: ../../ldap/ldap.jpg
|
||||
mkdir -p $(dir $@)
|
||||
$(CP) $< $@
|
||||
|
||||
pngs/%.png: jpgs/%.jpg
|
||||
mkdir -p $(dir $@)
|
||||
$(info making $(@F) in $(@D))
|
||||
magick $< $@
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# Bling: makefile2graph
|
||||
|
||||
```graph
|
||||
|
||||
┌────────────────┐ ┌────────────────────┐
|
||||
│ forts/long.txt │ ◀── │ forts/ │
|
||||
└────────────────┘ └────────────────────┘
|
||||
│ │
|
||||
│ │
|
||||
│ ▼
|
||||
│ ┌────────────────────┐
|
||||
│ │ forts/short.txt │
|
||||
│ └────────────────────┘
|
||||
│ │
|
||||
│ │
|
||||
│ ▼
|
||||
│ ┌────────────────────┐
|
||||
└──────────────────▶ │ forts/big_fort.txt │
|
||||
└────────────────────┘
|
||||
```
|
||||
|
||||
### Gotcha: The Binary is Called `make2graph`
|
||||
|
||||
- Works with GUI tools maybe, IDK, I don't use Windows.
|
||||
- Some systems can use `graph-easy`, but it's outdated.
|
||||
|
||||
***
|
||||
|
||||
# Patsubst and Wildcards
|
||||
|
||||
|
||||
```make pats
|
||||
IMAGES = $(wildcard jpgs/*)
|
||||
COL = $(patsubst jpgs/%,collection/%,$(IMAGES))
|
||||
|
||||
.PHONY: show
|
||||
show:
|
||||
$(info IMAGES is $(IMAGES))
|
||||
$(info Col is $(COL))
|
||||
|
||||
.PHONY: output
|
||||
output: $(COL)
|
||||
|
||||
collection/%.jpg: jpgs/%.jpg
|
||||
mkdir -p $(@D)
|
||||
cp $< $@
|
||||
|
||||
```
|
||||
|
||||
***
|
||||
|
||||
# Use Cases
|
||||
|
||||
- Backups
|
||||
- Making Websites
|
||||
* `git clone https://gitlab.com/bindrpg/blag`
|
||||
- `NOT installations`
|
||||
- ...but maybe installations?
|
||||
- Setting
|
29
slides/passwords/passwords.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Passwords
|
||||
|
||||
# User
|
||||
|
||||
- different services have different password requirements (special chars, lenghts)
|
||||
- entropy vs specific rules
|
||||
- passphrases (easy to remember)
|
||||
- generating random passwords (humans are bad at random)
|
||||
- password manager (forgetting passwords): KeePass (also generates passwords)
|
||||
1 Master password (needs to be remmebered/written down on physically secure medium)
|
||||
unlimited number of passwords encrypted with the master password
|
||||
KeePass requries a login to add a new password
|
||||
KeePass clears clipboard few seconds after copying the password
|
||||
some passwords managers are online, which adds risk
|
||||
- backups are important (passwords more likely to get lost than hacked)
|
||||
- its good to change passwords reguraly, but it is less important than other good practices
|
||||
|
||||
# Programmer
|
||||
|
||||
- storing user passwords adds risks of hacker gaining a lot of passwords at once
|
||||
- hash functions create unique data corresponding to each user password from which it can't be directly determined what the password was, but it can be checked if a specifc password hashes to that value
|
||||
- salted hashes are hash values that are stored with additional data which is added to the password before hashing it, makes each hash value unique, even if two passwords are the same
|
||||
|
||||
# Hacker
|
||||
|
||||
- if the hash function is difficult to calculate for a specific password, it is more secure, since attackers need to spend more resources to check if a specificv password hashes to needed data
|
||||
- MD5 is too easy to calculate, so a hacker can calculate hash values of many different passwords and check if some of them are same as users hash
|
||||
- hashcat
|
||||
|
15
slides/random/random.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Random
|
||||
|
||||
# Uses
|
||||
|
||||
- games
|
||||
|
||||
- cryptography
|
||||
|
||||
# Unprdictability
|
||||
|
||||
- Unsafe randoms can be predicted (shouldn't be used in cryptography)
|
||||
|
||||
- Entropy gathering (some OS don't wait on boot to gether entropy, many routers hacked this way)
|
||||
|
||||
- /dev/random is not more secure than /dev/urandom (used to be the case)
|
BIN
slides/rsa/dhke.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
slides/rsa/github-verified.png
Normal file
After Width: | Height: | Size: 41 KiB |
240
slides/rsa/rsa.md
Normal file
@@ -0,0 +1,240 @@
|
||||
---
|
||||
title:
|
||||
- RSA - Asimetricna kriptografija i primena
|
||||
author:
|
||||
- Aleksej Jocic
|
||||
|
||||
theme:
|
||||
- Warsaw
|
||||
colortheme:
|
||||
- orchid
|
||||
---
|
||||
|
||||
# Uvod
|
||||
- Simetricna kriptografija
|
||||
Isti kljuc za sifrovanje i desifrovanje
|
||||
|
||||
$10101 \oplus 11001 = 01100$
|
||||
|
||||
$(m \oplus k) \oplus k =m \oplus (k \oplus k)= m \oplus 0= m$
|
||||
- Problem bezbedne razmene kljuceva
|
||||
- Problem autenticnosti
|
||||
|
||||
# Uvod
|
||||
- Asiemtricna kriptografija
|
||||
- Razliciti kljucevi za sifrovanje i desifrovanje
|
||||
|
||||
- $f(m,k1)=c$
|
||||
|
||||
- $f(c,k2)=m$
|
||||
- Kljuc za sifrovanje je javno dostupan, (svi znaju $k1$)
|
||||
- Sifrovanje privatnim kljucem korisceno kao digitalni potpis
|
||||
|
||||
- $f(m,k2)=c$
|
||||
|
||||
- $f(c,k1)=m$
|
||||
|
||||
# RSA
|
||||
- RSA
|
||||
- 1977\. Ron Rivest, Adi Shamir, Leonard Adleman
|
||||
- 1976\. Diffie–Hellman razmena kljuceva
|
||||
|
||||
- $g^a \equiv A \mod p$
|
||||
|
||||
- $g^b \equiv B \mod p$
|
||||
|
||||
- $A^b \equiv (g^a)^b$$\equiv (g^b)^a$$\equiv B^a$$\mod p$
|
||||
|
||||
# RSA
|
||||
<div>
|
||||

|
||||
</div>
|
||||
|
||||
# RSA
|
||||
## Mala Fermaova teorema
|
||||
Ako je $p$ prost broj, za svako $a$ vazi:
|
||||
|
||||
|
||||
$a^{p-1} \equiv 1 \mod p$
|
||||
|
||||
|
||||
|
||||
## Posledica
|
||||
Ako su $p$ i $q$ prosti brojevi, za svako $a$ vazi:
|
||||
|
||||
|
||||
$a^{(p-1)(q-1)}$$\equiv ({a^{p-1}})^{q-1}$$\equiv 1 \mod q$
|
||||
|
||||
|
||||
$a^{(p-1)(q-1)}$$\equiv ({a^{q-1}})^{p-1}$$\equiv 1 \mod p$
|
||||
|
||||
|
||||
$(a^{(p-1)(q-1)}-1)$ je deljivo i sa $p$ i $q$.
|
||||
|
||||
|
||||
$p$ i $q$ su prosti, pa mora da je deljivo i sa $p \cdot q$.
|
||||
|
||||
|
||||
# RSA
|
||||
|
||||
## Posledica
|
||||
$a^{(p-1)(q-1)} \equiv 1 \mod pq$
|
||||
|
||||
|
||||
Takodje:
|
||||
|
||||
$a^{x(p-1)(q-1)}$$\equiv ({a^x})^{(p-1)(q-1)}$$\equiv 1 \mod pq$
|
||||
|
||||
|
||||
$a^{x(p-1)(q-1)+1} \equiv a \mod pq$
|
||||
|
||||
\pause
|
||||
## Trazimo
|
||||
$e$ i $d$ tako da:
|
||||
|
||||
|
||||
$({a^e})^d \equiv a^{ed} \equiv a^{x(p-1)(q-1)+1} \mod pq$
|
||||
|
||||
|
||||
Odnosno:
|
||||
|
||||
$ed \equiv 1 \mod (p-1)(q-1)$
|
||||
|
||||
|
||||
$d$ je modularni inverz od $e$ pod modulom $(p-1)(q-1)$
|
||||
|
||||
|
||||
Mozemo koristiti `Produzeni Euklidov algoritam`.
|
||||
|
||||
|
||||
U buduce cemo oznacavati $n=pq$, a $\varphi(n)=(p-1)(q-1)$
|
||||
|
||||
|
||||
$a^{\varphi(n)} \equiv 1 \mod n$
|
||||
|
||||
|
||||
$a^{ed} \equiv a^{x\varphi(n)+1}$$\equiv a \mod n$
|
||||
|
||||
|
||||
# RSA
|
||||
|
||||
- Problem faktorisanja $n=pq$
|
||||
- $\varphi(n)=(p-1)(q-1)$ nije poznato bez $p$ i $q$
|
||||
- $d$ kao modularni inverz od $e$ nije poznat bez $\varphi(n)$
|
||||
- $d$ mozemo da cuvamo tajnim cak i ako objavimo $e$ i $n$ javno
|
||||
|
||||
|
||||
# RSA
|
||||
- Generisanje kljuceva
|
||||
- Nadjimo velike proste brojeve $p$ i $q$
|
||||
|
||||
|
||||
Testovi prostosti brojeva (Fermaov test)
|
||||
- Generisemo $n=pq$
|
||||
- Nadjimo $e$ koji je uzajamno prost sa $(p-1)(q-1)$
|
||||
- Nadjimo $d$ koriscenjem Produzenog Euklidovog algoritma
|
||||
- Mozemo zaboraviti $p$ i $q$, jer nam vise ne trebaju
|
||||
|
||||
# Sifrovanje i potpisivanje
|
||||
|
||||
- Javni kljuc se sastoji od brojeva $e$ i $n$
|
||||
|
||||
$m^e \equiv C \mod n$
|
||||
|
||||
- Privatni kljuc se sastoji od brojeva $d$ i $n$
|
||||
|
||||
$C^d \equiv m \mod n$
|
||||
|
||||
- Digitalni potpis se postize sifrovanjem sa privatim kljucem
|
||||
|
||||
$m^d \equiv S \mod n$
|
||||
|
||||
- Provera digitalnog potpisa:
|
||||
|
||||
$S^e \equiv m \mod n$
|
||||
|
||||
# Prodruzeni Euklidov algoritam
|
||||
|
||||
```
|
||||
def egcd(a, b):
|
||||
if a == 0:
|
||||
return (b, 0, 1)
|
||||
g, y, x = egcd(b%a,a)
|
||||
return (g, x - (b//a) * y, y)
|
||||
|
||||
def modinv(a, m):
|
||||
g, x, y = egcd(a, m)
|
||||
if g != 1:
|
||||
raise Exception('No modular inverse')
|
||||
return x%m
|
||||
```
|
||||
|
||||
# Napadi na RSA
|
||||
|
||||
- Napadi na RSA
|
||||
- Pogadjanje poruke, potrebno dopunjavanje poruke random podacima (padding)
|
||||
- Premali eksponent $e$, korenovanje sifrovanog teksta za male poruke (veliko $e$)
|
||||
- Koriscenje istog eksponenta za vise kljuceva, napad koriscenjem Kineske teoreme o ostatku (random izabrano $e$)
|
||||
- Desifrovanje sumnjivog teksta, $(x^e \cdot C)^d \equiv (x^e)^d \cdot C^d \equiv x \cdot m \mod n$
|
||||
|
||||
# Primena
|
||||
|
||||
## GNU Privacy Guard
|
||||
- 1999\. Werner Koch
|
||||
- Generisanje kljuca: `gpg --gen-key`
|
||||
- Lista javnih kljuceva: `gpg --list-keys`
|
||||
- Export privatnih kljuceva: `gpg --export-secret-keys --output backup.gpg`
|
||||
- Upload kljuceva: `gpg --send-key [KEYID]`
|
||||
- Sifrovanje poruke: `gpg -e file.txt`
|
||||
- Desifrovanje: `gpg -d file.txt`
|
||||
- Potpisivanje poruke ili fajla: `gpg -s file.exe`
|
||||
- Potpisivanje kljuca: `gpg --sign-key [KEYID]`
|
||||
- ASCII output: `gpg --armor -se file.txt`
|
||||
- GPG password manager: `gpg --armor -c passwords.txt`
|
||||
|
||||
# Primena
|
||||
|
||||
## Git
|
||||
- Podesavanje kljuca: `git config --global user.signingkey [KEYID]`
|
||||
- Potpisivanje komita: `git commit -S`
|
||||
<div>
|
||||

|
||||
</div>
|
||||
|
||||
# Primena
|
||||
|
||||
## SSH
|
||||
- Generisanje kljuca: `ssh-keygen [-f filename]`
|
||||
- Dodavanje kljuca na remote masinu: `ssh-copy-id [-i filename] user@hostname`
|
||||
- `~/.ssh/authorized_keys`
|
||||
|
||||
# The Onion Router
|
||||
|
||||
## Tor
|
||||
- 1990\.-te United States Naval Research Laboratory (Paul Syverson,Michael G. Reed,David Goldschlag)
|
||||
- 20.9.2002. prva verzija Tor-a (javni projekat, anonimnosti u masi)
|
||||
|
||||
|
||||
# The Onion Router
|
||||
|
||||
<div>
|
||||

|
||||
</div>
|
||||
|
||||
# Onion hidden services
|
||||
|
||||
<div>
|
||||

|
||||
</div>
|
||||
|
||||
# The Onion Router
|
||||
|
||||
- Napadi na Tor
|
||||
- Tor ne stiti od vremenske korelacije (pristup sa obe strane veze)
|
||||
- Slabosti u aplikacijama koje koriste Tor
|
||||
- Pogresno konfigurisane aplikacije
|
||||
- DNS Leak
|
||||
|
||||
# Hvala
|
||||
|
||||
Hvala na paznji!
|
BIN
slides/rsa/tor-onion-services.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
slides/rsa/tor.png
Normal file
After Width: | Height: | Size: 20 KiB |
144
slides/shells/shells.md
Normal file
@@ -0,0 +1,144 @@
|
||||
# Origin
|
||||
|
||||
- Used as a 'shell' around a bare-ass kernel.
|
||||
- People once considered a basic shell user-friendly.
|
||||
- Once worked as slow printing.
|
||||
|
||||
## Use Cases
|
||||
|
||||
- It's crazy-fast to write.
|
||||
- Try deleting a file in Python.
|
||||
- It's awful for any structured data.
|
||||
|
||||
# Bangs!
|
||||
|
||||
Don't say `#!/bin/bash` if you don't mean it!
|
||||
|
||||
| Bang! | Apraisal |
|
||||
|:------------------------|:--------------|
|
||||
| `#!/bin/bash` | reasonable |
|
||||
| `#!/bin/sh` | sensible |
|
||||
| `#!/bin/dash` | bad idea |
|
||||
| `#!/bin/zsh` | risky |
|
||||
| `#!/bin/ksh` | foolish |
|
||||
| `#!/usr/bin/env bash` | pathetic |
|
||||
| `#!/bin/fish` | madness |
|
||||
| `#!/bin/elvish` | genius |
|
||||
|
||||
Protip: for a faster machine, make `sh` a link to `/bin/dash`.
|
||||
|
||||
`ln -s /bin/dash /bin/dash`
|
||||
|
||||
# Deviant Shells
|
||||
|
||||
## `ksh` (korn shell)
|
||||
|
||||
- made before `bash`
|
||||
- `vi` mode by default (means you're a hacker)
|
||||
- Can be posix compliant with effort
|
||||
|
||||
## `elvish`
|
||||
|
||||
- pure style
|
||||
- built-in browser
|
||||
- Ctrl+i to search for commands in $PATH
|
||||
- Ctrl+n to search for command arguments
|
||||
- Ctrl+l to return to previous locations
|
||||
|
||||
## zsh
|
||||
|
||||
- `for x in 1..10`
|
||||
- great autocompletion
|
||||
|
||||
# Bash Advantages
|
||||
|
||||
- Equality check with "==".
|
||||
* Dash cannot do `if [ $x == 3 ]; then echo y; fi`
|
||||
- `$RANDOM`
|
||||
- Dash cannot use `&>/dev/null`
|
||||
- No history
|
||||
- `$PROMPT_COMMAND`
|
||||
|
||||
## Lists
|
||||
|
||||
```
|
||||
myList+=(*)
|
||||
echo "${myList[0]}"
|
||||
```
|
||||
|
||||
# Functions
|
||||
|
||||
|
||||
```
|
||||
function wotsa(){
|
||||
def="$(curl -s dict://dict.org/define:$1: | \
|
||||
grep -vP '^\d\d\d ')"
|
||||
if [ "$def" = "" ]; then
|
||||
echo no definition
|
||||
else
|
||||
echo "$def" | mdcat -p
|
||||
fi
|
||||
}
|
||||
```
|
||||
|
||||
# Protips
|
||||
|
||||
```
|
||||
"\C- ": shell-expand-line
|
||||
"\C-x": glob-expand-word
|
||||
```
|
||||
|
||||
- `set -e`
|
||||
- `set -x`
|
||||
- `set -o vi`
|
||||
- Ctrl+d
|
||||
- `type $whatever`
|
||||
- `.inputrc`
|
||||
- `PS1=foo`
|
||||
- `^$` for first argument used
|
||||
- `!$` for last argument used
|
||||
|
||||
# Fun with Bash
|
||||
|
||||
- wifi_qr.sh
|
||||
- clean.sh
|
||||
- theme.sh
|
||||
- notflix.sh
|
||||
- clip.sh
|
||||
- vidget.sh
|
||||
|
||||
# Zen Master Foo
|
||||
|
||||
Master Foo once said to a visiting programmer: "There is more Unix-nature in one line of shell script than there is in ten thousand lines of C."
|
||||
|
||||
The programmer, who was very proud of his mastery of C, said: "How can this be?
|
||||
C is the language in which the very kernel of Unix is implemented!"
|
||||
|
||||
Master Foo replied: "That is so.
|
||||
Nevertheless, there is more Unix-nature in one line of shell script than there is in ten thousand lines of C."
|
||||
|
||||
#
|
||||
|
||||
The programmer grew distressed. "But through the C language we experience the enlightenment of the Patriarch Ritchie! We become as one with the operating system and the machine, reaping matchless performance!"
|
||||
|
||||
Master Foo replied: "All that you say is true.
|
||||
But there is still more Unix-nature in one line of shell script than there is in ten thousand lines of C."
|
||||
|
||||
The programmer scoffed at Master Foo and rose to depart.
|
||||
But Master Foo nodded to his student Nubi, who wrote a line of shell script on a nearby whiteboard, and said: "Master programmer, consider this pipeline.
|
||||
Implemented in pure C, would it not span ten thousand lines?"
|
||||
|
||||
#
|
||||
|
||||
The programmer muttered through his beard, contemplating what Nubi had written.
|
||||
Finally he agreed that it was so.
|
||||
|
||||
"And how many hours would you require to implement and debug that C program?" asked Nubi.
|
||||
|
||||
"Many," admitted the visiting programmer. "But only a fool would spend the time to do that when so many more worthy tasks await him."
|
||||
|
||||
"And who better understands the Unix-nature?" Master Foo asked. "Is it he who writes the ten thousand lines, or he who,
|
||||
perceiving the emptiness of the task, gains merit by not coding?"
|
||||
|
||||
Upon hearing this, the programmer was enlightened.
|
||||
|
BIN
slides/stajedecentrala/qrcode.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
@@ -33,7 +33,8 @@ Ekipa koju interesuje :
|
||||
|
||||
# Lokacije
|
||||
|
||||
- DC Krov hacklab
|
||||
- KC Grad radionce
|
||||
- Matematicki Faklutet (cekamo)
|
||||
- Drugi fakulteti, skole?
|
||||
- DC Krov
|
||||
- KC Magacin
|
||||
|
||||
# Kontakt
|
||||

|
||||
|
20
slides/tor/tor.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Tor, Relays, Onions
|
||||
|
||||
# Tor
|
||||
|
||||
- Hides IP address
|
||||
- Hard to censor
|
||||
- Timing attack
|
||||
|
||||
# Relays
|
||||
|
||||
- Middle relays
|
||||
- Guard relays
|
||||
- Exit relays
|
||||
|
||||
# Onion services
|
||||
|
||||
- Hides IP address
|
||||
- Any TCP service
|
||||
- No DNS, no SSL
|
||||
- Private keys
|
84
slides/vim/vim.md
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
title:
|
||||
- RSA - vi improved
|
||||
author:
|
||||
- Malin
|
||||
|
||||
theme:
|
||||
- Warsaw
|
||||
colortheme:
|
||||
- orchid
|
||||
---
|
||||
|
||||
# Myths, Half-Truths and Lies
|
||||
|
||||
- You can get `vim`-keys in other programs
|
||||
* Yea, nah
|
||||
- `vim` [ is/ is not ] an IDE
|
||||
* UNIX is the IDE
|
||||
- `vim` is hard
|
||||
* It's four commands!
|
||||
|
||||
## Heresies
|
||||
|
||||
> Emacs: "a great operating system, lacking only a decent editor"
|
||||
|
||||
> `code`, because everything is a web browser.
|
||||
|
||||
# `vim` is a Language
|
||||
|
||||
- `d$`
|
||||
- `y$`
|
||||
- `dp`
|
||||
- `dip`
|
||||
- `di[`
|
||||
- `vi[p`
|
||||
|
||||
# Plugins: Just Don't
|
||||
|
||||
```
|
||||
|
||||
/home/ghost/.vim
|
||||
|-- doc
|
||||
| |-- completion.txt
|
||||
| |-- manet.txt
|
||||
| |-- tags
|
||||
|-- plugin -> /home/ghost/.dots/mess/vim/plugin
|
||||
| |-- completion.vim
|
||||
| |-- manet.vim
|
||||
|-- skel -> /home/ghost/.dots/mess/vim/skel
|
||||
| |-- bindAnimal.tex
|
||||
| |-- bindArtefact.tex
|
||||
| |-- bindCharacter.tex
|
||||
| |-- wod_vampire.tex
|
||||
|-- spell
|
||||
|-- en.utf-8.add
|
||||
|-- en.utf-8.add.spl
|
||||
|-- sr.utf-8.spl
|
||||
|
||||
```
|
||||
|
||||
# Tricks
|
||||
|
||||
## Remote Editing
|
||||
|
||||
> vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt*
|
||||
|
||||
## File Navigation
|
||||
|
||||
```bash
|
||||
vim .
|
||||
```
|
||||
|
||||
## Tabs
|
||||
|
||||
```bash
|
||||
vim -p .bash*
|
||||
```
|
||||
## Literally Anything
|
||||
|
||||
|
||||
```bash
|
||||
r!fortune
|
||||
```
|
||||
|
18
slides/webdevpython/webdevpython.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
theme:
|
||||
- Warsaw
|
||||
colortheme:
|
||||
- orchid
|
||||
---
|
||||
|
||||
# Uvod
|
||||
- Cilj je da stavimo python programe na web stranicu
|
||||
# Radionica
|
||||
- mkdir dct-web (pravimo folder koji se zove "dct-web")
|
||||
- Virtuelno okruzenje, ne zelimo da se sistemski instaliran python ne zelimo da utice na ovu aplikaciju.
|
||||
Ako imate dva razlicita projekta u pythonu koji koriste razlicite verzije pythona i biblioteka, onda je bolje da se napravi virtuelno okruzenje.
|
||||
Takodje korisno za pouzdano instaliranje dependency biblioteka.
|
||||
- Pitanje: Da li web browseri rade u pythonu? Ne, sada su uglavnom napisani u C++
|
||||
- python3 -m venv venv (pravimo folder venv koji sadrzi fajlove potrebne za to okruzenje)
|
||||
- source venv/bin/activate (aktiviramo to okruzenje)
|
||||
- HTTP protokol je skup pravila komunikacije izmedju web browser i web server
|