openssl req -nodes -x509 -sha256 -newkey rsa:4096 \
-keyout example.org.key \
-out example.org.crt \
-days 356 \
-subj "/C=NL/ST=Zuid Holland/L=Rotterdam/O=ACME Corp/OU=IT Dept/CN=example.org" \
-addext "subjectAltName = DNS:localhost,DNS:example.org"
Individual science fiction stories may seem as trivial as ever to the blinder critics and philosophers of today — but the core of science fiction, its essence, the concept around which it revolves, has become crucial to our salvation if we are to be saved at all.
Command line tool for URL parsing and manipulation
Replace the host name of a URL:
$ trurl --url https://curl.se --set host=example.com
https://example.com/
Create a URL by setting components:
$ trurl --set host=example.com --set scheme=ftp
ftp://example.com/
Redirect a URL:
$ trurl --url https://curl.se/we/are.html --redirect here.html
https://curl.se/we/here.html
Change port number:
$ trurl --url https://curl.se/we/../are.html --set port=8080
https://curl.se:8080/are.html
Extract the path from a URL:
$ trurl --url https://curl.se/we/are.html --get '{path}'
/we/are.html
Extract the port from a URL:
$ trurl --url https://curl.se/we/are.html --get '{port}'
443
Append a path segment to a URL:
$ trurl --url https://curl.se/hello --append path=you
https://curl.se/hello/you
Append a query segment to a URL:
$ trurl --url "https://curl.se?name=hello" --append query=search=string
https://curl.se/?name=hello&search=string
Read URLs from stdin:
$ cat urllist.txt | trurl --url-file -
...
Output JSON:
$ trurl "https://fake.host/hello#frag" --set user=::moo:: --json
[
{
"url": "https://%3a%3amoo%3a%3a@fake.host/hello#frag",
"parts": {
"scheme": "https",
"user": "::moo::",
"host": "fake.host",
"path": "/hello",
"fragment": "frag"
}
}
]
Remove tracking tuples from query:
$ trurl "https://curl.se?search=hey&utm_source=tracker" --trim query="utm_*"
https://curl.se/?search=hey
Show a specific query key value:
$ trurl "https://example.com?a=home&here=now&thisthen" -g '{query:a}'
home
Sort the key/value pairs in the query component:
$ trurl "https://example.com?b=a&c=b&a=c" --sort-query
https://example.com?a=c&b=a&c=b
Work with a query that uses a semicolon separator:
$ trurl "https://curl.se?search=fool;page=5" --trim query="search" --query-separator ";"
https://curl.se?page=5
Accept spaces in the URL path:
$ trurl "https://curl.se/this has space/index.html" --accept-space
https://curl.se/this%20has%20space/index.html
It's quite easy to compile the C source with GCC:
$ make
cc -W -Wall -pedantic -g -c -o trurl.o trurl.c
cc trurl.o -lcurl -o trurl
trurl is also available in some Linux distributions. You can try searching for it using the package manager of your preferred distribution.
make
, just like on Linux.Development files of libcurl (e.g. libcurl4-openssl-dev
or
libcurl4-gnutls-dev
) are needed for compilation. Requires libcurl version
7.62.0 or newer (the first libcurl to ship the URL parsing API).
trurl also uses CURLUPART_ZONEID
added in libcurl 7.81.0 and
curl_url_strerror()
added in libcurl 7.80.0
It would certainly be possible to make trurl work with older libcurl versions
if someone wanted to.
trurl builds with libcurl older than 7.81.0 but will then not work as
good. For all the documented goodness, use a more modern libcurl.
"for begginers" haha, I'd like to see friends of mine try this one out
I was too lazy to write anything remotely as clean as this so I asked Kagi's integration of Mistral Large:
Sure, here's an example of how you could create a
systemd
timer to automatically renice existing Google Chrome processes.
- First, create a new service file. You can use any text editor you like, but for this example, we'll use
nano
:sudo nano /etc/systemd/system/renice-chrome.service
- In the service file, add the following lines:
[Unit] Description=Renice Google Chrome processes [Service] Type=oneshot ExecStart=/bin/bash -c 'for pid in $(pgrep chrome); do ionice -c3 -p $pid; renice 19 -p $pid; done'
This service file defines a new service that runs a bash command to find all Google Chrome processes (using
pgrep chrome
), and then appliesionice
andrenice
to each process.
Save and close the file.
Next, create a new timer file:
sudo nano /etc/systemd/system/renice-chrome.timer
- In the timer file, add the following lines:
[Unit] Description=Run renice-chrome.service every hour [Timer] OnCalendar=hourly Persistent=true [Install] WantedBy=timers.target
This timer file defines a new timer that runs the
renice-chrome.service
every hour.
Save and close the file.
Now, enable and start the timer:
sudo systemctl enable renice-chrome.timer sudo systemctl start renice-chrome.timer
- You can check the status of the timer with:
sudo systemctl list-timers
This will show you a list of all active timers, including when they're next due to run.
Please note that this will only affect Google Chrome processes that are already running when the timer runs. If you want to also lower the priority of new Google Chrome processes as they're launched, you would need to use a different approach, such as the script I described in my previous answer.
Also, remember to replace
chrome
with the correct process name if it's different on your system. You can check the process name withpgrep chrome
. If it doesn't return anything, trypgrep chromium
orpgrep google-chrome
.