Quickly set up a new Linux (Debian, Ubuntu based) machine with minimal utilities for general work.
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
sudo apt-get install jq | |
HUGO_VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.tag_name') | |
curl -sSL "https://github.com/gohugoio/hugo/releases/download/${HUGO_VERSION}/hugo_extended_${HUGO_VERSION:1}_linux-amd64.deb" -o hugo.deb | |
sudo dpkg -i hugo.deb | |
hugo version |
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 | |
# Generate the key | |
ssh-keygen -t ed25519 | |
# Add it to the ssh-agent | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/id_ed25519 | |
# Set appropriate permissions | |
chmod 600 ~/.ssh/id_ed25519 | |
# Show the public key so you can copy it to GitHub |
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
[alias] | |
# Adapted from https://blog.jez.io/cli-code-review/ | |
# List files which have changed since BASE | |
# Set BASE in shell configuration or before the command | |
files = !git diff --name-only $(git merge-base HEAD \"$BASE\") | |
# With stat for interactive use | |
stat = !git diff --stat $(git merge-base HEAD \"$BASE\") | |
# Put heatmap on your path: |
This is a markup render hook for Hugo sites to change the behavior of image links in your built site. It should live at layouts/_default/_markup/render-image.html
.
If the image link begins with http
, the link will be rendered as-is.
If not, the page permalink will prefix the image URL to produce the full path to the image in the rendered site page.
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
from powerline_shell.themes.default import DefaultColor | |
dark0 = 235 | |
dark1 = 237 | |
dark2 = 239 | |
dark3 = 241 | |
dark4 = 243 | |
light0 = 229 | |
light1 = 223 |
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
```python | |
# Create the Checker class | |
class Checker: | |
# Queue of links to be checked | |
TO_PROCESS = Queue() | |
# Maximum workers to run | |
THREADS = 100 | |
# Maximum seconds to wait for HTTP response | |
TIMEOUT = 60 |
Task | Time | |
---|---|---|
CPU | execute typical instruction | 1/1,000,000,000 sec = 1 nanosec |
CPU | fetch from L1 cache memory | 0.5 nanosec |
CPU | branch misprediction | 5 nanosec |
CPU | fetch from L2 cache memory | 7 nanosec |
RAM | Mutex lock/unlock | 25 nanosec |
RAM | fetch from main memory | 100 nanosec |
Network | send 2K bytes over 1Gbps network | 20,000 nanosec |
RAM | read 1MB sequentially from memory | 250,000 nanosec |
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
🐣 Initial commit | |
📜 Add LICENSE | |
🖍 Minor edit | |
🔧 Fix * | |
🌱 Add * |
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
# Look in the public/ directory | |
find public/ \ | |
# Ignore directories called "static" regardless of location | |
-not -path "*/static/*" \ | |
# Print the file paths of all files ending with any of these extensions | |
\( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' \) -print0 \ | |
# Pipe the file paths to xargs and use 8 parallel workers to process 2 arguments | |
| xargs -0 -P8 -n2 \ | |
# Tell mogrify to strip metadata, and... | |
mogrify -strip \ |
NewerOlder