Skip to content

Instantly share code, notes, and snippets.

@BoZenKhaa
BoZenKhaa / .gitconfig
Last active January 29, 2023 14:20 — forked from NamPNQ/.gitconfig
Pycharm as a default git difftool and git mergetool on Windows. Add the following to ~/.gitconfig
[diff]
tool = pycharm
[difftool "pycharm"]
cmd = "/c/Program\ Files/JetBrains/PyCharm 2019.1.1/bin/pycharm" diff "$LOCAL" "$REMOTE" && echo "Press enter to continue..." && read
[merge]
tool = pycharm
keepBackup = false
[mergetool "pycharm"]
cmd = "/c/Program Files/JetBrains/PyCharm 2019.1.1/bin/pycharm" merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
@Darkhogg
Darkhogg / !RebootToOs.md
Last active July 25, 2024 10:49
"Reboot to {OS}" scripts for rEFInd Next Boot selection

Reboot to {OS}

This a collection of notes and files used in my quest to create "Reboot to Windows" and "Reboot to Linux" scripts (and desktop shortcuts) for Linux and Windows respectively that automatically reboot my system and instruct rEFInd to auto-select the appropriate OS entry.

General Information

The key for achieving this is to modify the EFI Variable PreviousBoot with GUID 36d08fa7-cf0b-42f5-8f14-68df73ed3740, which rEFInd uses to store the last entry selected in the menu and, if using the + default entry, will be used to select the default OS. By doing this, we trick rEFInd into booting the OS we choose without having to be physically there to press the keyboard.

@nathforge
nathforge / expbackoff.sh
Created December 22, 2016 10:33
Exponential backoff in Bash
expbackoff() {
# Exponential backoff: retries a command upon failure, scaling up the delay between retries.
# Example: "expbackoff my_command --with --some --args --maybe"
local MAX_RETRIES=${EXPBACKOFF_MAX_RETRIES:-8} # Max number of retries
local BASE=${EXPBACKOFF_BASE:-1} # Base value for backoff calculation
local MAX=${EXPBACKOFF_MAX:-300} # Max value for backoff calculation
local FAILURES=0
while ! "$@"; do
FAILURES=$(( $FAILURES + 1 ))
if (( $FAILURES > $MAX_RETRIES )); then

Me:

I'm missing the 4G connection details in order to set up my Lenovo Connect SIM on Linux.

I discovered that I can't find the APN used by Lenovo Connect anywhere.

Lenovo Connect

Hi Joar,

Thank you for your email.

@rdoursenaud
rdoursenaud / .multitailrc
Created June 11, 2015 13:18
Multitail configuration for Dolibarr syslog
colorscheme:dolibarr
bright:1
cs_re:yellow,red:.*EMERG.*
cs_re:white,red:.*ALERT.*
cs_re:green,red:.*CRIT.*
cs_re:red:.*ERR.*
cs_re:white,yellow:.*WARNING.*
cs_re:green,yellow:.*NOTICE.*
cs_re:green:.*INFO.*
cs_re:white:.*DEBUG.*
@rdoursenaud
rdoursenaud / otrs.conf
Created May 20, 2015 08:37
OTRS FCGIWRAP SSL+HSTS NGINX configuration
server {
listen 443 ssl;
listen [::]:443 ssl;
keepalive_timeout 70;
server_name otrs.example.com;
root /opt/otrs/var/httpd/htdocs;
index index.html;
# SSL
@imjasonh
imjasonh / markdown.css
Last active May 24, 2024 22:56
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@rdoursenaud
rdoursenaud / shinken.conf
Last active November 14, 2015 09:32
Shinken nginx reverse proxy configuration
# Reverse proxy for Shinken 2.0.x on Debian Wheezy
# Place this file under /etc/nginx/sites-available
# Update your server_name
# Don't forget to enable the config and reload nginx
# Enjoy ^^
server {
# IPv4 support
listen 80;
# IPv6 support
listen [::]:80;
{
"Type":"UnencryptedConfiguration",
"NetworkConfigurations":[
{
"GUID":"{%GUID_A%}",
"Name":"%NAME%",
"Type":"VPN",
"VPN":{
"Type":"OpenVPN",
"Host":"%HOSTNAME%",