Skip to content

Instantly share code, notes, and snippets.

@acdha
acdha / simple_cors_server.py
Last active April 25, 2024 07:13
Python 3: serve the current directory as HTTP while setting CORS headers for XHR debugging
#!/usr/bin/env python3
# encoding: utf-8
"""Use instead of `python3 -m http.server` when you need CORS"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
@rbonvall
rbonvall / redirect.py
Created April 4, 2014 20:36
Redirect both stdin and stdout of a process to a PyQt text edit.
from PyQt4 import QtGui, QtCore, uic
def p(x):
print x
class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QWidget.__init__(self)
uic.loadUi('redirect.ui', self)
ProductName;LicensePartNumber;LicenseSKUID
APP CONNECT IW;SPZA_IW;8f0c5670-4e56-4892-b06d-91c085d7004f
Microsoft 365 Audio Conferencing;MCOMEETADV;0c266dff-15dd-4b49-8397-2bb16070ed52
AZURE ACTIVE DIRECTORY BASIC;AAD_BASIC;2b9c8e7c-319c-43a2-a2a0-48c5c6161de7
AZURE ACTIVE DIRECTORY PREMIUM P1;AAD_PREMIUM;078d2b04-f1bd-4111-bbd4-b4b1b354cef4
AZURE ACTIVE DIRECTORY PREMIUM P2;AAD_PREMIUM_P2;84a661c4-e949-4bd2-a560-ed7766fcaf2b
AZURE INFORMATION PROTECTION PLAN 1;RIGHTSMANAGEMENT;c52ea49f-fe5d-4e95-93ba-1de91d380f89
DYNAMICS 365 CUSTOMER ENGAGEMENT PLAN ENTERPRISE EDITION;DYN365_ENTERPRISE_PLAN1;ea126fc5-a19e-42e2-a731-da9d437bffcf
DYNAMICS 365 FOR CUSTOMER SERVICE ENTERPRISE EDITION;DYN365_ENTERPRISE_CUSTOMER_SERVICE;749742bf-0d37-4158-a120-33567104deeb
DYNAMICS 365 FOR FINANCIALS BUSINESS EDITION;DYN365_FINANCIALS_BUSINESS_SKU;cc13a803-544e-4464-b4e4-6d6169a138fa
local function dowobble(cel, data, dataoffset)
local img = cel.image:clone()
-- local selection = cel.sprite.selection
for it in img:pixels() do
local nx = it.x
local ny = it.y
local seed = data.dir == "y" and it.x or it.y
-- Frequency is number of pixels it takes to perform full phase
local pos = (seed + dataoffset) / data.frequency
local offset = math.floor(math.sin(pos * math.pi * 2) * data.amplitude)
@randallreedjr
randallreedjr / heroku-remote.md
Last active April 25, 2024 07:06
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@lucaspar
lucaspar / nvenc-install.sh
Last active April 25, 2024 07:01
Installation script of CUDA-accelerated `ffmpeg` with NVIDIA Encoder
#!/bin/bash
# =========================================================================
# Source: https://gist.github.com/lucaspar/27f5e108b80524b315be10b2a9049817
# =========================================================================
# This script will compile and install a static FFmpeg build with
# support for NVENC in Ubuntu. Developed in Ubuntu 23.10,
# with NVIDIA Drivers v535.129.03 and CUDA v12.2 with a GPU
# with CUDA capability 8.6 (RTX 3080) (see ccap below).
# It assumes NVIDA drivers are installed and that you have a
# CUDA-compatible GPU. You can check installed drivers with:
@jidckii
jidckii / alertmanager.tmpl
Created April 5, 2023 14:08
Alertmanager telegram template
{{ define "__yucca_text_alert_list" }}{{ range . }}
---
🪪 <b>{{ .Labels.alertname }}</b>
{{- if .Annotations.summary }}
📝 {{ .Annotations.summary }}{{ end }}
{{- if .Annotations.description }}
📖 {{ .Annotations.description }}{{ end }}
🏷 Labels:
{{ range .Labels.SortedPairs }} <i>{{ .Name }}</i>: <code>{{ .Value }}</code>
{{ end }}{{ end }}
@AshtakaOOf
AshtakaOOf / gui.md
Last active April 25, 2024 07:00
Stable Diffusion GUI list

Stable Diffusion GUIs list

This will help me and hopefully other to get everything going and generate waifus images with Stable Diffusion, and maybe other txt2img things maybe.

I will probably add shields.io to make it more easier to read (maybe)

Tip

Check out the SD Anime Checkpoints list.

  • Glossary
@eeropic
eeropic / paste-svg-from-clipboard-paper.js
Last active April 25, 2024 06:58
Paste SVG to Paper.js from clipboard
//CC2018
document.addEventListener('paste', function(evt) {
//Import SVG copied to clipboard from Illustrator
//remove last hidden character that will otherwise break the import
if(document.activeElement.nodeName!="TEXTAREA"){
var str=evt.clipboardData.getData('text/plain').slice(0, -1);
var svg=project.importSVG(str)
svg.clipped=false;
svg.children[0].remove()
svg.parent.insertChildren(svg.index,svg.removeChildren());