Skip to content

Instantly share code, notes, and snippets.

@llagerlof
llagerlof / Search my gists.md
Created July 4, 2023 15:41 — forked from OrenBochman/Search my gists.md
How to search gists

Gist Search Cheatsheet

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:orenbochman

Find all gists with a .yml extension.
extension:yml

@llagerlof
llagerlof / ds
Created June 14, 2023 12:15
Shell script (bash) that shows the available space of the largest partition of each disk. Ignores disks without partitions.
#!/bin/bash
# Example output:
# Disk: sda (894.25 GB)
# Largest partition: sda1
# Used space: 878 GB
# Available space: 17 GB
# Disk: sdb (222.57 GB)
# Largest partition: sdb2
@llagerlof
llagerlof / gist:c04b366bd9be4c86c7ca4ce3ba3147cb
Created March 29, 2023 18:22
Autodetect audio devices if they were not recognized by Fedora 36
sudo dnf swap wireplumber pipewire-media-session
systemctl --user restart pipewire-media-session
reboot
@llagerlof
llagerlof / check_cpu_temperature.bash
Last active December 15, 2022 01:19
Script to check the CPU temperature and alert (gnome) if above threshold
#!/bin/bash
# It's supposed to run on a interval. Example to run each 5 seconds:
#
# watch -n 5 ./check_cpu_temperature.bash
cpu_temp=$(sensors | grep "CPU Temperature" | grep -Eo '[0-9]+' | head -n 1)
echo "$cpu_temp" >> ~/.cpu-temperature
if ((cpu_temp > 75)); then
@llagerlof
llagerlof / mkdir_automated.sh
Last active August 29, 2022 13:00
Create a directory, copy the full path to the clipboards and enter the directory
# Paste this function into your ~/.bashrc
# Before use, install the xclip package of your distro, if isn't installed yet.
# Create a directory, copy the full path to the clipboards and enter the directory
md() {
mkdir "$1" || return 1
realpath "$1" | tr -d '\n' | xclip -selection clipboard
realpath "$1" | tr -d '\n' | xclip
cd "$1"
}
@llagerlof
llagerlof / starship.toml
Created August 26, 2022 12:57 — forked from ryo-ARAKI/starship.toml
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "⚡"
[[battery.display]]
threshold = 30
style = "bold red"
@llagerlof
llagerlof / git-deployment.md
Created July 18, 2022 13:35 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@llagerlof
llagerlof / wmic terminal command
Created July 5, 2022 11:36
Windows information in Command Prompt
source: https://quux.wiki.zoho.com/WMIC-Snippets.html
-----
System, BIOS, Motherboard
This first example shows a few variations of the most common WMI query. We ask a WMI object (computersystem, or bios, or baseboard in the examples below) to return the values for a few of its properties. It returns the results in its default tabular format.
C:\Tools>wmic computersystem get domain, EnableDaylightSavingsTime, Manufacturer, Model, PartOfDomain, TotalPhysicalMemory, username
Domain EnableDaylightSavingsTime Manufacturer Model PartOfDomain TotalPhysicalMemory UserName
@llagerlof
llagerlof / grep files
Created June 24, 2022 12:10
Search files recursively containing some string, filter by extension and show only the filenames.
grep -inRsHl --include \*.php "str" ./
# -i = insensitive
# -R = recursive
@llagerlof
llagerlof / web-servers.md
Created May 20, 2022 12:41 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000