Skip to content

Instantly share code, notes, and snippets.

@user21944
user21944 / temp.sh
Last active October 12, 2020 22:07
Print the current CPU temperature of your Raspberry Pi in Celsius.
#!/bin/bash
#RPi CPU tempreture
echo "$(($(< /sys/class/thermal/thermal_zone0/temp)/1000))°C"
@user21944
user21944 / youtube-download.sh
Last active October 24, 2020 01:07
This is a oneliner that depends on curl, Perl and jq to download a YouTube video. Replace the existing URL with your own.
curl 'https://www.youtube.com/watch?v=BaW_jenozKc' | perl -ne 'print if s/.*ytplayer\.config\s*=\s*(\{.+?});ytplayer.*/\1/' | jq -r '.args.player_response | fromjson | .streamingData.formats | max_by(.bitrate) | .url'
const fs = require("fs");
let i = 1;
let n = "0\n";
for (i = 1; i <= 1000000; i++) n += `${i.toString()}\n`;
fs.writeFile("message.txt", n, err => {
if (err) return console.error(err);
});
@user21944
user21944 / .gitkeep
Created November 16, 2020 14:21
.gitkeep
@user21944
user21944 / debian.txt
Created April 6, 2021 13:56
[!] Configuring popularity-contest
┏━━━━━━━━━━━━━━━┫ [!] Configuring popularity-contest ┣━━━━━━━━━━━━━━━┓
┃ The system may anonymously supply the distribution developers with statistics about the ┃
┃ most used packages on this system. This information influences decisions such as which ┃
┃ packages should go on the first distribution CD. ┃
┃ ┃
┃ If you choose to participate, the automatic submission script will run once every week, ┃
┃ sending statistics to the distribution developers. The collected statistics can be viewed ┃
┃ on https://popcon.debian.org/. ┃
┃ ┃
┃ This choice can later be modified by running "dpkg-reconfigure popularity-contest" ┃
@user21944
user21944 / hello but epic.c
Last active September 23, 2021 14:39
Hello world but better
/* Directive */ /* Value */
#include <stdio.h>
/* Type */ /* Name */ /* Arguments */
int main (void)
{ /* Name */ /* Arguments */
; puts ("Hello, World!")
/* Statement */ /* Value */
; return 0
;}
#\
i\
n\
c\
l\
u\
d\
e\
\
<\
@user21944
user21944 / pfetch-no-palette-newline.diff
Created June 2, 2021 19:01
Patch pfetch to not print a newline after the palette display.
diff --git a/pfetch b/pfetch
index 039a898..9d350a1 100755
--- a/pfetch
+++ b/pfetch
@@ -1038,10 +1038,8 @@ get_palette() {
palette="$palette$e"
}
- # Print the palette with a new-line before and afterwards.
- printf '\n' >&6
#!/bin/zsh
alias -g gutt="git"
@user21944
user21944 / mkmit
Created May 16, 2022 23:15
Bash/zsh function to generate a copy of The MIT License
#!/bin/bash
mkmit() {
[[ -e LICENSE ]] && printf "A LICENSE file already exists\n" && return
cat << EOF > LICENSE
MIT License
Copyright (c) $(date +%Y) $([[ -n $1 ]] && printf "%s " "$@" || whoami)