This file contains 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
import operator | |
import re | |
import sys | |
import urllib.request | |
banner_read_sofar = """Type what you know so far. | |
Keep the Green ones where they are, and leave '.' for unknown: """ | |
banner_grey_letters = """Type in the grey letters | |
All, or the new ones you learned in previous step: """ |
This file contains 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
import operator | |
import re | |
import sys | |
import urllib.request | |
banner_read_sofar = """Type what you know so far. | |
Keep the Green ones where they are, and leave '.' for unknown: """ | |
banner_grey_letters = """Type in the grey letters | |
All, or the new ones you learned in previous step: """ |
This file contains 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
import operator | |
import re | |
import sys | |
import urllib.request | |
banner_read_sofar = """Type what you know so far. | |
Keep the Green ones where they are, and leave '.' for unknown: """ | |
banner_grey_letters = """Type in the grey letters | |
All, or the new ones you learned in previous step: """ |
This file contains 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
// Package main shows an example for providing multiple values to the same | |
// command line parameter - with builtin `flag` in Go. | |
package main | |
import ( | |
"flag" | |
"fmt" | |
"strings" | |
) |
This file contains 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
package main | |
import ( | |
"fmt" | |
"sort" | |
) | |
/* | |
Sometimes it is not enough to know whether an element is in the slice. One | |
may want to insert a new element into the slice. But without knowing what |
This file contains 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
function flatten(arr) { | |
if (arr.length == 0) { | |
return []; | |
} | |
const first = arr[0]; | |
const flatRest = flatten(arr.slice(1)); | |
if (!Array.isArray(first)) { | |
return [first].concat(flatRest); |
This file contains 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
dm-crypt with LUKS | |
------------------ | |
LUKS with dm-crypt has better encryption and makes it possible to have multiple passphrase for the same partition or to change the password easily. To test if LUKS is available, simply type # cryptsetup --help, if nothing about LUKS shows up, use the instructions below Without LUKS. First create a partition if necessary: fdisk /dev/sdc. | |
Create encrypted partition | |
# dd if=/dev/urandom of=/dev/sda3 # Optional. For paranoids only (takes days) | |
# cryptsetup -y luksFormat /dev/sda3 # This destroys any data on sda3 | |
# cryptsetup luksOpen /dev/sda3 sda3 | |
# mkfs.ext3 /dev/mapper/sda3 # create ext3 file system |
This file contains 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
/* | |
* Binary Tree | |
* Binary Search Tree | |
* AVL Tree | |
* | |
* All in pure Javascript, ES6 classes and with inheritance. | |
*/ | |
This file contains 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
package main | |
import "fmt" | |
// VanEck generates the first n elements in the Van-Eck sequence | |
// https://oeis.org/A181391 | |
// Thanks to: https://www.youtube.com/watch?v=etMJxB-igrc | |
func VanEck(limit int64) []int64 { | |
// prepare the basics. The output, and the lookup |
This file contains 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
package main | |
import ( | |
"fmt" | |
) | |
// fillChannel simply fills the channel with i, i+2, i+4, ... | |
func fillChannel(ch chan int, i int) { | |
for { | |
ch <- i |
NewerOlder