Skip to content

Instantly share code, notes, and snippets.

@swuecho
swuecho / proxmox-import-disk-image.txt
Created August 12, 2020 00:56
Add import existing disk image into Proxmox
#
# The official PVE docs on how to prepare cloud-init templates:
# https://pve.proxmox.com/wiki/Cloud-Init_Support#_preparing_cloud_init_templates
#
# Additional guides and resources:
# https://dae.me/blog/2340/how-to-add-an-existing-virtual-disk-to-proxmox/
# https://pve.proxmox.com/pve-docs/qm.1.html
# use the Qemu/KVM Virtual Machine Manager to import the disk
qm importdisk 107 Univention-App-kopano-core-KVM.qcow2 local-lvm
@swuecho
swuecho / scala-http-postgres-html-docker.scala
Created January 24, 2024 14:08 — forked from keynmol/scala-http-postgres-html-docker.scala
Sample gist showing how to run a HTTP server with Typelevel Scala libraries, and a postgres docker container
//> using dep "org.http4s::http4s-scalatags::0.25.2"
//> using dep "org.http4s::http4s-dsl::0.23.23"
//> using dep "org.http4s::http4s-ember-server::0.23.23"
//> using dep "org.tpolecat::skunk-core::0.6.0"
//> using dep "com.dimafeng::testcontainers-scala-postgresql::0.41.0"
//> using dep "com.outr::scribe-slf4j::3.12.2"
import skunk.*, codec.all.*, syntax.all.*
import cats.effect.*
import scalatags.Text.all.*
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net"
"os"
"strings"
"unicode"
function handleRequest(request) {
const { pathname } = new URL(request.url);
// Respond with HTML
if (pathname.startsWith("/html")) {
const html = `<html>
<p><b>Message:</b> Hello from Deno Deploy.</p>
</html>`;
return new Response(html, {
@swuecho
swuecho / restore_db_in_docker.sh
Created August 19, 2020 05:50
gitea postgres docker db restore
mkdir gitea
cp docker-compose.yml gitea/
cp gitea-dump-1597294525.zip gitea/
cd gitea
unzip gitea-dump-1597294525.zip
unzip gitea-repo.zip
@swuecho
swuecho / remove_tag.zsh
Created August 11, 2020 07:44
git remove tag
#for release in `seq 15 34`;
#do
#git push --delete origin release-v0.0.$release
#done
# git tag | head -n 10 | xargs git push --delete origin -
for release in `git tag`;
do
echo $release;
git push --delete origin $release
real 8m5.110s
user 164m38.999s
sys 16m41.641s
@swuecho
swuecho / xhr.js
Created November 22, 2019 14:51
make request and post form
function makeRequest(method, url) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open(method, url);
xhr.onload = function () {
if (this.status >= 200 && this.status < 300) {
resolve(xhr.response);
} else {
# modified from the python code in
# https://pizzaseminar.speicherleck.de/automatic-differentiation/notes.pdf
class Dual(object):
def __init__(self, x, a=0):
self.x = x
self.a = a
def __add__(self, other):
#Creates a new issue with custom fields
curl -D- -u uname:pass -X POST --data "{\"fields\": {\"project\": { \"id\": \"10430\" },\"summary\": \"This is a test issue\", \"description\": \"Description\",\"issuetype\": { \"id\" : \"1\"}, \"components\" : [{\"id\":\"10731\"}], \"customfield_10711\" : [{\"id\":\"10500\"}] } }" -H "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/issue/
#Returns all information for all versions
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/project/AN/versions?
#Returns all issues in a version
#This URL requires the version ID of a single version which is provided by the above query
curl -D- -u uname:pass -X PUT -d "Content-Type: application/json" http://localhost:8080/jira/rest/api/2/search?jql=project="AN"+AND+fixVersion='12345'