All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Register

Login


All New Register Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated
anthony's Avatar

anthony / ltrim(), rtrim(), and trim() in awk

0 likes
0 forks
1 files
Last active 1741339039
Taken from https://gist.github.com/andrewrcollins/1592991
awk shell
1 function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
2 function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
3 function trim(s) { return rtrim(ltrim(s)); }
4 BEGIN {
5 # whatever
6 }
7 {
8 # whatever
9 }
10 END {
anthony's Avatar

anthony / Minimal nginx reverse-proxy

0 likes
0 forks
1 files
Last active 1740393244
For example, to pass HTTP-requests to docker containers
docker nginx
1 server {
2 listen 80;
3 listen [::]:80;
4 server_name example.com; # replace with your domain
5
6 access_log /var/log/nginx/access.log;
7 error_log /var/log/nginx/error.log;
8 #client_max_body_size 100M;
9
10 location / {
anthony's Avatar

anthony / Block bots and crawlers in nginx

0 likes
0 forks
1 files
Last active 1740389947
nginx
1 map $request_uri $reject {
2 "~(yandexbot)" 0;
3 "~(googlebot)" 0;
4 "~(ClaudeBot).*" 1;
5 "~(Amazonbot).*" 1;
6 "~(SemrushBot).*" 1;
7 "~(meta-externalagent).*" 1;
8 "~(DataForSeoBot).*" 1;
9 "~(Screaming Frog SEO Spider).*" 1;
10 "~(GetRight).*" 1;
anthony's Avatar

anthony / Doxygen in docker

0 likes
0 forks
2 files
Last active 1740232072
dockerfile
1 FROM alpine:latest AS doxygen
2
3 RUN apk add --no-cache \
4 doxygen \
5 graphviz \
6 fontconfig \
7 font-noto \
8 font-noto-emoji \
9 font-noto-cjk
anthony's Avatar

anthony / Как читать права файлов

0 likes
0 forks
1 files
Last active 1740126335
linux
flag  user  group  other
#     rwx    rwx    rwx
- Отсутствие флага (файл)
l Символическая ссылка (symbolic link)
d Директория (directory)
b Блочное устройство (block device)
c Символьное устройство (character device)
anthony's Avatar

anthony / Backup your project to another server (scp)

0 likes
0 forks
1 files
Last active 1740064541
scp shell ssh
1 #!/bin/bash
2 #####################################################################
3 # #
4 # Stupidly simple backup script for own projects #
5 # #
6 # Author: Anthony Axenov (Антон Аксенов) #
7 # Version: 1.0 #
8 # License: WTFPLv2 More info: https://axenov.dev/?p=1423 #
9 # #
10 #####################################################################
anthony's Avatar

anthony / Backup your project to another server (scp/s3)

0 likes
0 forks
1 files
Last active 1740064516
s3 s3cmd scp shell ssh
1 #!/bin/bash
2 #####################################################################
3 # #
4 # Stupidly simple backup script for own projects #
5 # #
6 # Author: Anthony Axenov (Антон Аксенов) #
7 # Version: 1.2 #
8 # License: WTFPLv2 More info (RU): https://axenov.dev/?p=1272 #
9 # #
10 #####################################################################
anthony's Avatar

anthony / My favorite bash aliases

0 likes
0 forks
1 files
Last active 1740109971
bash dotfiles shell zsh
1 #!/bin/bash
2
3 # alias bashrc='source ~/.bashrc'
4 alias zshrc='source ~/.zshrc'
5 alias realias='source ~/.bash_aliases'
6 alias reload='exec ${SHELL} -l'
7 alias sudo='sudo ' # enable aliases to be sudo’ed
8 alias g='git'
9 alias hosts="sudo nano /etc/hosts"
10 alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
anthony's Avatar

anthony / Backup files synced from Syncthing

0 likes
0 forks
2 files
Last active 1740033429
shell syncthing
1 # Daemon file
2 # Place or symlink it to /etc/systemd/system/inotifywait-cp.service
3 # Enable and start: sudo systemctl enable --now inotifywait-cp
4 # Check it: sudo systemctl status inotifywait-cp
5
6 [Unit]
7 Description=Photosync from android
8
9 [Service]
10 Type=simple
anthony's Avatar

anthony / CUE-sheet generator for youtube-dl

0 likes
0 forks
1 files
Last active 1740033278
shell
1 #!/bin/bash
2 # CUE-sheet generator for youtube-dl
3
4 # Usage:
5 # 0. Install 'jq' utility
6 # 1. Download any audio file with metadata from YouTube or Youtube Music, e.g.
7 # $ youtube-dl \
8 # --extract-audio \
9 # --audio-format flac \
10 # --audio-quality 0 \
Newer Older

Powered by Opengist ⋅ Load: 462ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文