Skip to content

Instantly share code, notes, and snippets.

@Slach
Slach / backup-cronjob.yaml
Created April 16, 2024 13:17
clickhouse-backup CronJob examples
apiVersion: batch/v1
kind: CronJob
metadata:
name: clickhouse-backup-cron
spec:
# every day at 00:00
# schedule: "0 0 * * *"
schedule: "* * * * *"
concurrencyPolicy: "Forbid"
jobTemplate:
@mwaskom
mwaskom / replacing_seaborn_distplot.ipynb
Last active April 16, 2024 13:18
A guide to replacing the deprecated `seaborn.distplot` function.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 16, 2024 13:18
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@vivekkr12
vivekkr12 / BouncyCastleCertificateGenerator.java
Last active April 16, 2024 13:17
Generate root X509Certificate, Sign a Certificate from the root certificate by generating a CSR (Certificate Signing Request) and save the certificates to a keystore using BouncyCastle 1.5x
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.asn1.x509.Extension;
import org.bouncycastle.asn1.x509.GeneralName;
import org.bouncycastle.asn1.x509.KeyUsage;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
@darrarski
darrarski / FormattedTextField.swift
Last active April 16, 2024 13:14
SwiftUI FormattedTextField - TextField with custom display/edit formatters
import SwiftUI
public struct FormattedTextField<Formatter: TextFieldFormatter>: View {
public init(_ title: String,
value: Binding<Formatter.Value>,
formatter: Formatter) {
self.title = title
self.value = value
self.formatter = formatter
}
@jamesfreeman959
jamesfreeman959 / keepawake.ps1
Last active April 16, 2024 13:14
A very simple PowerShell script to keep a Windows PC awake and make lync think the user is active on the keyboard
# Useful references:
#
# https://superuser.com/questions/992511/emulate-a-keyboard-button-via-the-command-line
# https://ss64.com/vb/sendkeys.html
# https://social.technet.microsoft.com/Forums/windowsserver/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell?forum=winserverpowershell
# https://learn-powershell.net/2013/02/08/powershell-and-events-object-events/
#
# Future enhancements - use events rather than an infinite loop
$wsh = New-Object -ComObject WScript.Shell
while (1) {
@hitman401
hitman401 / main.rs
Last active April 16, 2024 13:12
Producer Consumer Sample in RUST
use std::sync::{Arc, Mutex, Condvar};
use std::thread;
struct Producer {
cvar: Arc<(Mutex<bool>, Condvar)>
}
impl Producer {
pub fn new(cvar: Arc<(Mutex<bool>, Condvar)>) -> Producer {
Producer {
@piyushgarg-dev
piyushgarg-dev / README.md
Last active April 16, 2024 13:10
Kafka Crash Course
@amishmm
amishmm / ArchOracleCloud.md
Last active April 16, 2024 13:09
Install Arch Linux on Oracle Cloud (Free Tier)

Requirement

  • Console / Cloud Shell access (via https://cloud.oracle.com)
  • Go to the instance page and under Resources -> Console connection -> Launch Cloud Shell connection

Steps

  1. In Ubuntu OR any other Free tier Linux OS
# Download Alpine Linux and install it on disk
cd /
wget https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-virt-3.16.2-x86_64.iso
@samanalysis
samanalysis / README.md
Created March 24, 2017 12:49 — forked from schierlm/README.md
VBoxGopHack - custom EFI GOP modes for VirtualBox

VBoxGopHack

VirtualBox's VESA support is excellent, you can define your own video modes with exotic resolutions like 1350x660 (so that the screen fits perfectly on a 1366x768 host), even if the guest operating system is exotic enough so that no Guest Additions exist.

Unfortunately, the situation for EFI is not as well. EfiGopMode supports 5 fixed resolutions, and although the Uga parameters suggest that arbitrary resolutions are possible, it seems that the Uga implementation internally falls back to GOP and just picks the "best" GOP mode instead. (After a few hours of digging through the EFI code in vbox