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
| # sourcing this file will define a bash functions that | |
| # tries to run subsequent calls to emacs with 24 bit color. | |
| # | |
| # It sets TERM=xterm-emacs-leg if | |
| # - we've created a user-local terminfo record for xterm-emacs-leg, and | |
| # - we're using iTerm2 or something has set COLORTERM=truecolor | |
| # | |
| # This will cause emacs to use 24 bit color only when it will work, | |
| # inside or outside of tmux. I haven't found a way to auto-detect Blink.sh yet. | |
| # |
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
| mkdir liburing | |
| pushd liburing | |
| git clone https://github.com/axboe/liburing.git | |
| pushd liburing | |
| ./configure | |
| make | |
| sudo make install | |
| popd |
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
| import asyncio | |
| import socket | |
| BIND_IP = "127.0.0.1" | |
| TCP_PORT = 1234 | |
| SOCK_BACKLOG = 32 | |
| IP_TRANSPARENT = 19 | |
| desc = f""" | |
| Anybind; "bind" on many IPs and many Ports. |
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/env python | |
| """Extend Python's built in HTTP server to save files | |
| curl or wget can be used to send files with options similar to the following | |
| curl -X PUT --upload-file somefile.txt http://localhost:8000 | |
| wget -O- --method=PUT --body-file=somefile.txt http://localhost:8000/somefile.txt | |
| __Note__: curl automatically appends the filename onto the end of the URL so |
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
| """ | |
| This gist shows how to run asyncio loop in a separate thread. | |
| It could be useful if you want to mix sync and async code together. | |
| Python 3.7+ | |
| """ | |
| import asyncio | |
| from datetime import datetime | |
| from threading import Thread | |
| from typing import Tuple, List, Iterable |
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
| wget -O /tmp/YaHei.Consolas.1.12.zip https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/uigroupcode/YaHei.Consolas.1.12.zip | |
| unzip /tmp/YaHei.Consolas.1.12.zip | |
| sudo mkdir -p /usr/share/fonts/consolas | |
| sudo mv YaHei.Consolas.1.12.ttf /usr/share/fonts/consolas/ | |
| sudo chmod 644 /usr/share/fonts/consolas/YaHei.Consolas.1.12.ttf | |
| cd /usr/share/fonts/consolas | |
| sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv |
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/env bash | |
| # | |
| # Run parallel commands and fail if any of them fails. | |
| # | |
| set -eu | |
| pids=() | |
| for x in 1 2 3; do |
Save these files as ~/.config/systemd/user/some-service-name.*
Run this now and after any modifications: systemctl --user daemon-reload
Try out the service (oneshot): systemctl --user start some-service-name
Check logs if something is wrong: journalctl -u --user-unit some-service-name
Start the timer after this user logs in: systemctl --user enable --now some-service-name.timer
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
| SELECT * FROM wp_posts | |
| LEFT JOIN wp_term_relationships ON | |
| (wp_posts.ID = wp_term_relationships.object_id) | |
| LEFT JOIN wp_term_taxonomy ON | |
| (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) | |
| WHERE wp_posts.post_type = 'post' | |
| AND wp_term_taxonomy.taxonomy = 'category' | |
| AND wp_term_taxonomy.term_id = 48 | |
| ORDER BY post_date DESC |
NewerOlder