Skip to content

Instantly share code, notes, and snippets.

@cblte
cblte / maurelia.py
Created June 30, 2024 10:00
Download all images from the soon to close webshop. With the images you can then redraw the things you want for plotting
import requests
from bs4 import BeautifulSoup
import os
from urllib.parse import urljoin, urlparse
from tqdm import tqdm
# Create a folder to save images
os.makedirs('maurelia_images', exist_ok=True)
#!/bin/bash
# This script will stop the service, backup the data folder including
# the database, the attachments and keys of your vaultwarden installation.
# Only the last 14 backups will be kept. If you want to keep more or less, please
# adjust the time on the last line of the script
# for this script to work to work adjust the following 4 folders to your environment
# timestamp added to the backup filename e.g. 20220130-1325
NOW=$(date +'%Y%m%d-%H%M')

How to import own modules in Jupyter

Solution one: do it inside jupyter

Here is what I do on my projects in jupyter notebook,

import sys
sys.path.append("../") # go to parent dir
from customFunctions import *
cat > /etc/apk/repositories << EOF; $(echo)
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/main
http://dl-cdn.alpinelinux.org/alpine/v$(cat /etc/alpine-release | cut -d'.' -f1,2)/community
EOF
apk update

The best way to store your dotfiles: A bare Git repository

ORIGINAL BLOG POST https://www.atlassian.com/git/tutorials/dotfiles

Disclaimer: the title is slightly hyperbolic, there are other proven solutions to the problem. I do think the technique below is very elegant though.

Recently I read about this amazing technique in an Hacker News thread on people's solutions to store their dotfiles. User StreakyCobra showed his elegant setup and ... It made so much sense! I am in the process of switching my own system to the same technique. The only pre-requisite is to install Git.

@cblte
cblte / hookfile.sh
Last active September 13, 2021 01:04
PHP Script to execute shellscript (hookfile.sh) via Github Webhook in a secure way. Environment works for uberspace.de. Static site gen is hugo (gohugo.io)
#!/bin/bash
# --------------------
# place this file anywhere where it can be execute fromthe webhook.php file.
# make sure, you put the correct path to this file into the webhook.php
# webdirectory is a directory accessible via internet, but not the main websites directory
# .. ideally webdirectory is a access via subdomain
# --------------------
# set PATH
@cblte
cblte / gitlab-webhook-push.php
Created April 22, 2021 18:25 — forked from pitchart/gitlab-webhook-push.php
A simple php script to manage gitlab push webhook
<?php
/**
* GitLab Web Hook
* See https://gitlab.com/kpobococ/gitlab-webhook
*
* This script should be placed within the web root of your desired deploy
* location. The GitLab repository should then be configured to call it for the
* "Push events" trigger via the Web Hooks settings page.
*
* Each time this script is called, it executes a hook shell script and logs all
<html>
<head>
<style>
body {
font-family: Verdana, sans-serif;
margin: auto;
padding: 20px;
text-align: left;
background-color: #fff;
@cblte
cblte / main.go
Created April 9, 2021 08:10 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@cblte
cblte / AsciidocCheatsheet.adoc
Created March 26, 2021 12:31 — forked from powerman/AsciidocCheatsheet.adoc
Asciidoc cheatsheet for GitHub

Asciidoc cheatsheet for GitHub