Skip to content

Instantly share code, notes, and snippets.

@kwonghung-YIP
kwonghung-YIP / backup-docker-secrets.sh
Created October 15, 2019 03:26
Shell script for export all secrets defined in docker swarm
#!/bin/bash
service_name="backup-all-secrets"
secret_list=( `docker secret ls --format "{{ .Name }}"` )
cmd="docker service create \
--name $service_name \
--constraint node.hostname==`hostname` "
for secret in "${secret_list[@]}"
@noahcoad
noahcoad / GoAwayModalDialogs.ahk
Created January 3, 2013 21:04
Automates away pesky modal dialogs.
; ==========================================================================================
; == Modal Dialog Automation
; ==
; == Automates away pesky modal dialogs by applying a default response when they pop up
; == Helper functions are at the bottom
; ==========================================================================================
; Defaults to fast no-regex title matching
SetTitleMatchMode, 2
@sgdc3
sgdc3 / jsontomidi.js
Last active May 7, 2024 10:49
LittleBigPlanet Music Sequencer MIDI Dumper
/*
* LittleBigPlanet Music Sequencer MIDI Dumper
* NodeJS script that extracts music sequencer data from LBP levels in JSON format (jsoninator format)
*
* Author: @sgdc3
* Version: 0.1
* Latest Update: 06 May 2024
*
* HINT: You can obtain the JSON level data using https://github.com/ennuo/toolkit/tree/main/tools/jsoninator
*
@In-line
In-line / Dockerfile
Last active May 7, 2024 10:49
AMD 7900 XTX Stable Diffusion Web UI docker container (ROCM 5.5_rc4)
FROM rocm/composable_kernel:ck_ub20.04_rocm5.5_rc4
RUN mkdir /SD
# Clone SD
WORKDIR /SD
RUN git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
WORKDIR /SD/stable-diffusion-webui
RUN git reset --hard 22bcc7be428c94e9408f589966c2040187245d81
@AlexMikhalev
AlexMikhalev / get-obsidian-posts.py
Created January 19, 2021 13:46
Sync notion to obsidian world md
from notion.client import NotionClient
import datetime
import os
from slugify import slugify
import re
import requests
import time
import hashlib
import shutil
import sys
@0atman
0atman / configuration.nix
Last active May 7, 2024 10:47
A rebuild script that commits on a successful build
{
config,
pkgs,
options,
...
}: let
hostname = "oatman-pc"; # to alllow per-machine config
in {
networking.hostName = hostname;
@nik-hil
nik-hil / MultipleFieldLookupORMixin.py
Last active May 7, 2024 10:47
Django REST framework support only one lookup field at a time. To support more than one field we have to use MultipleFieldLookupMixin. But it has a limitation. It require all fields to be present in URL. I have different requirement. I can call view using two differnet identifier.
class MultipleFieldLookupORMixin(object):
"""
Actual code http://www.django-rest-framework.org/api-guide/generic-views/#creating-custom-mixins
Apply this mixin to any view or viewset to get multiple field filtering
based on a `lookup_fields` attribute, instead of the default single field filtering.
"""
def get_object(self):
queryset = self.get_queryset() # Get the base queryset
queryset = self.filter_queryset(queryset) # Apply any filter backends
filter = {}
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@lucataco
lucataco / ollama_fast_speech_text_speech.py
Last active May 7, 2024 10:44
speech to text to speech using Ollama
""" To use: install Ollama, clone OpenVoice, run this script in the OpenVoice directory
brew install portaudio
brew install git-lfs
git lfs install
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .