#bash #oneliner to compose a 15x10 cm image with 600 dpi for printing 8 passport photos, each of them exactly 35x45 mm
#!bin/bash
montage $1 $1 $1 $1 $1 $1 $1 $1 -geometry 827x1063 -tile 4x2 -pointsize 31 -title 'print as 15x10 cm => 600 dpi, each photo will be 35x45 mm. Use 2nd line as stencil to cut 1st line.' $2
usage: command source target
* `systemctl link` allows you to start using unit files in any place of the filesystem. This can be used for products that install in `/opt/`.
* not really TIL, just a #oneliner to get python3's current version:
python3 -c 'import sys; print(".".join(sys.argv[2].split(".")[:2]))' $(python3 --version)
[get the text from python --version as positional arguments, take the second one, split by dots ('.'), take the first two elements, join again with dots, *pant*, *pant*]
#til #oneliner #systemd #python
@www.jvt.me Because I’m a #Perl guy I turned that into a #OneLiner with the power of @mojolicious:
perl -Mv5.20 -Mojo -E 'for my $url (@ARGV) { say j(g($url)->dom("head link[rel=alternate]")->map( sub { $_->{type} =~ m{^application/(rss|atom)\+xml$} ? { href => l( $_->{href} )->to_abs( l($url) ), $_->%{"title", "type"} } : () } )->TO_JSON) }'
@jxyzn @barubary @Perl Note that’s not best practice #Perl *code* in that #OneLiner. It uses the = assignment operator when you almost always want the == comparison operator.
The point is that perl v5.36 and later’s implicit `use warnings` won’t get triggered. If you wrote it like this, you *would* get warnings and errors to STDERR and a non-zero exit code indicating failure:
perl -Mv5.36 -e ‘say “hello” if $foo = 1’
@jxyzn @barubary @Perl Yep, basically don’t use `perl -E` unless you want your #OneLiner to pick up the current feature bundle for your installation:
• https://perldoc.perl.org/perlrun#-E-commandline
• https://perldoc.perl.org/feature#IMPLICIT-LOADING
#Shell scripts with `perl -E` one-liners may *break* if you upgrade #perl or run them somewhere else with a different installed version.
Here’s a way to enable a specific feature bundle without implicitly enabling `use strict` or `use warnings`:
perl -Mfeature=:5.36 -e ‘say “hello” if $x = 1’
Jimmy Carr reeled the audience in. #COVID19 #JimmyCarr #OneLiner #StandUpComedy
#standupcomedy #oneliner #jimmycarr #COVID19
DOI='10.1145/3356903'
curl "https://api.crossref.org/works/${DOI}" \
| jq -r '.message.abstract' \
| { \
echo '<article xmlns:mml="http://www.w3.org/1998/Math/MathML" dtd-version="1.2"><body>'
cat
echo '</body></article>'
} \
| pandoc --from jats --to commonmark
# Given DOI, get the article abstract (if it is available)
RT @onyphe
#Oneliner of the day:
onyphe -search 'domain:http://example.com | uniq ip | search category:vulnscan -exists:cve ip:$ip'
That's a correlation search: it takes output from datascan and feeds vulnscan with IPs.
Download and play:
https://github.com/onyphe/training/blob/master/Onyphe-4.00.tar.gz
Détecter des pixels noirs, ou de niveaux de gris juqu'à -50% du noir, dans une ligne de pixels, avec Image Magic
convert -colorspace rgb image.png -background white -flatten -crop WIDTHxLIGNE+0+0 -threshold 50% txt:- | grep "#000000" | cut -d "," -f1
Bon bha j'ai ce vient trick à recoder en Python parce qu'il parait que c'est trop "barbu/chevelu" dans un shell-scipt ... 😜
#imagemagic #trick #oneliner #cli #python #shellscript
Missing sea? Here are the waves. Another #commodore64 #oneliner by Ian Witham. ⌨️🌊〰️
Caro Livello Segreto,
visto che al supermercato mi hanno chiesto di "TIRARE" dei #C64 è arrivato il momento che ti racconti dei miei #oneliner in 79 caratteri in #basic.
Per l'occasione ho scritto due righe qua:
https://www.mat64.org/dancing-with-the-basic/
BONUS STAGE: Find the easter-eggs in the basic code.
Substack, more like Substandard and Subhuman, amirite? #AntiVax #Conspiracy #OneLiner 🤣 :BlobfoxThinking:
#antivax #conspiracy #oneliner
Useful #PowerShell #OneLiner that I found today, to get the names of your RS232 serial COMx ports, for when you need to do serial communications and don't want to go digging through Device Manager:
[System.IO.Ports.SerialPort]::GetPortNames()
#powershell #oneliner #sysadmin #devops
TIL: One-line list manipulation in Python
https://kevingimbel.de/blog/2023/01/til-one-line-list-manipulation-in-python/
#python #oneliner #dev #blog #programming
My favourite BBC Micro game is a BASIC one-liner from 1984 called "Asterisk Tracker". You can play it here - but you should probably know before you start that you need to hold RETURN to go up, or press SPACE to start a new game:
#onebutton #game #basic #oneliner #bbcmicro