Skip to content

Commit

Permalink
Add shutdown TIL
Browse files Browse the repository at this point in the history
  • Loading branch information
acdibble committed Apr 20, 2021
1 parent 2866173 commit fa133a6
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 37 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ others" and "this is something really annoying that took forever to find out and
I know I'll come across it again at some point so I want it committed for
posterity".

35 TILs and growing!
36 TILs and growing!

---

Expand Down Expand Up @@ -65,6 +65,7 @@ posterity".
- [List directories only](linux/list-directories-only.md)
- [`mv` Tips and Tricks](linux/mv-tips-and-tricks.md)
- [Oh My Zsh Aliases](linux/oh-my-zsh-aliases.md)
- [`shutdown` aliases](linux/shutdown-aliases.md)
- [String manipulation](linux/string-manipulation.md)
- [U2F](linux/u2f.md)
- [`which`](linux/which.md)
Expand Down
10 changes: 8 additions & 2 deletions createTIL.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ const sortLowerCase = (a, b) => (topicToFileName(a) < (topicToFileName(b)) ? -1

const structure = JSON.parse(fs.readFileSync('structure.json', 'utf8'));
structure[newCategory] = (structure[newCategory] || []).concat([newTopic]).sort(sortLowerCase);
fs.writeFileSync('structure.json', JSON.stringify(structure, null, 2), 'utf8');
const output = Object.keys(structure)
.sort((a, b) => catToDir(a) < catToDir(b) ? -1 : 1)
.reduce((acc, cat) => {
acc[cat] = structure[cat];
return acc;
}, {});
fs.writeFileSync('structure.json', JSON.stringify(output, null, 2), 'utf8');

const tilCount = Object.values(structure).reduce((acc, tils) => acc + tils.length, 0);

Expand All @@ -53,7 +59,7 @@ ${tilCount} TILs and growing!
`);

const categories = ['', '---', ''];
Object.keys(structure).sort(sortLowerCase).forEach((category) => {
Object.keys(output).forEach((category) => {
readme.write(`- [${category}](#${category.replace(/ /g, '-')})\n`);
categories.push(
`### ${category}`,
Expand Down
7 changes: 7 additions & 0 deletions linux/shutdown-aliases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `shutdown` aliases

`shutdown` can be used with `-H` to halt, `-r` to reboot, or `-h` to power off a
machine. There are simple aliases for these flags: `halt`, `reboot` and
`poweroff` respectively.

See `man shutdown` for more info.
69 changes: 35 additions & 34 deletions structure.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,61 @@
"C++": [
"Scoped enums"
],
"Elixir": [
"Base encoding methods",
"Get last value in IEx",
"Releases",
"Test coverage",
"Test setup",
"Turn on history in IEx"
],
"git": [
"Find file creation date",
"Push commit with tags",
"Set commit message editor"
],
"JavaScript": [
"File system flags in Node",
"Readline interface",
"Readline interface 2",
"Regular expression flags"
],
"vim": [
"Ruler"
],
"WebAssembly": [
"Break statements",
"Global variables",
"Memory management",
"Tables"
],
"Rails": [
"Active record attributes",
"`select` vs `pluck`"
],
"PostgreSQL": [
"Filter clause"
],
"VS Code": [
"External terminal"
],
"Ruby": [
"`squeeze`"
],
"Linux": [
"Finding size of folder",
"Force quit hung ssh",
"Killing other ssh connections",
"List directories only",
"`mv` Tips and Tricks",
"Oh My Zsh Aliases",
"`shutdown` aliases",
"String manipulation",
"U2F",
"`which`",
"Yubico Authenticator on Fedora"
],
"git": [
"Find file creation date",
"Push commit with tags",
"Set commit message editor"
],
"nginx": [
"Redirect requests to new domain"
],
"Elixir": [
"Base encoding methods",
"Get last value in IEx",
"Releases",
"Test coverage",
"Test setup",
"Turn on history in IEx"
"PostgreSQL": [
"Filter clause"
],
"Rails": [
"Active record attributes",
"`select` vs `pluck`"
],
"Ruby": [
"`squeeze`"
],
"vim": [
"Ruler"
],
"VS Code": [
"External terminal"
],
"WebAssembly": [
"Break statements",
"Global variables",
"Memory management",
"Tables"
]
}

0 comments on commit fa133a6

Please sign in to comment.