Hello there! Today, we're diving deep into the process of adding SSL certification to services deployed on a k3s cluster. By the end of this guide, you'll be able to securely serve your services over HTTPS, enhancing the security of your applications.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Storing cryptographic password hashes in database or memory | |
// and comparing with password. | |
package main | |
import ( | |
"log" | |
"errors" | |
"strings" | |
"crypto/subtle" | |
"encoding/base64" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function uuidgen() { | |
chunks=(4 2 2 2 6) | |
elems=() | |
for c in ${chunks[@]}; do | |
hex_chunk=$(xxd -l $c -p /dev/urandom) | |
elems+=( $hex_chunk ) | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Use this script if you have an external monitor (HDMI) and want that as primary display | |
# but switch to the laptop monitor (eDP) when the external monitor is off (power off or otherwise) | |
# Guess if you have the external monitor attached to a UPS device, you don't need this script...! | |
# Detect when monitor is powered off and switch the laptop display back on | |
# and vice-versa, keeping the external monitor as primary display whenever | |
# possible. | |
function get_laptop_display() { |
This is a write up on how to use thinkfan
on Lenovo ThinkPads running antiX Linux. I am writing from my (bad) experience after installing antiX Grup Yorum 21 on a Lenovo ThinkPad P15s with the fan running constantly at max speed.
This is based on the guide provided at https://gist.github.com/Yatoom/1c80b8afe7fa47a938d3b667ce234559 however since the thinkfan
utility does not seem to be available in the default repos of antiX Linux, it also includes steps to build the utility from source code - plus other tweaks for Thinkpad.
$ sudo apt install thinkfan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toggle_xcomp() { | |
# toggle X compositor | |
ret=`xfconf-query -c xfwm4 -p /general/use_compositing` | |
case "$ret" in | |
"false") echo "turning compositor on";xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s true;; | |
*) echo "turning compositor off";xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s false;; | |
esac | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Courtesy: @Fermatslibrary | |
// Reference: https://twitter.com/fermatslibrary/status/1275066521450975234 | |
// Copyright: Anand B Pillai @skeptichacker | |
// LICENSE: MIT | |
use std::env; | |
use std::collections::HashMap; | |
pub fn is_prime(n: u64) -> bool { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple get function which caches responses for a URL | |
using a LFU cache | |
""" | |
import requests | |
from collections import Counter | |
class LFUCache(object): | |
""" Least frequently used cache with caching done on SET """ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ docli droplet --snapshot 163461766 | |
╒═══════════════╤═════════════════════════════╕ | |
│ Fields │ Values │ | |
╞═══════════════╪═════════════════════════════╡ | |
│ SnapShot Id │ 53919120 │ | |
├───────────────┼─────────────────────────────┤ | |
│ SnapShot Name │ pfaas-sg-ps-1-1571760580915 │ | |
├───────────────┼─────────────────────────────┤ | |
│ Distribution │ Debian │ | |
├───────────────┼─────────────────────────────┤ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ scrapy shell -s HTTPCACHE_ENABLED=True | |
2017-02-28 10:41:41 [scrapy.utils.log] INFO: Scrapy 1.3.2 started (bot: httpbin) | |
(...) | |
>>> from scrapy.utils.misc import load_object | |
>>> storage = load_object(settings['HTTPCACHE_STORAGE'])(settings) | |
>>> storage.cachedir | |
'/home/paul/scrapy/httpbin/.scrapy/httpcache' |
NewerOlder