Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

var huginn = window.location.protocol + "//" + window.location.host
var auth_key = document.getElementsByName("csrf-token")[0].content;
for (var a in window.agentPaths) {
var url = huginn + window.agentPaths[a].match(/\/agents\/\d+/)[0] + "/remove_events"
console.log(url)
$.post(url,"_method=delete&authenticity_token=" + auth_key,function(data,success,xhr){
console.log("finish",url)
})
}
@shigenobuokamoto
shigenobuokamoto / network-mirrored.service
Last active April 23, 2024 12:35
/etc/systemd/system/network-mirrored.service
[Unit]
Wants=network-pre.target
Before=network-pre.target shutdown.target
[Service]
User=root
ExecStart=/bin/sh -ec '\
[ -x /usr/bin/wslinfo ] && [ "$(/usr/bin/wslinfo --networking-mode)" = "mirrored" ] || exit 0;\
echo "\
add chain ip nat WSLPREROUTING { type nat hook prerouting priority dstnat - 1; policy accept; };\
@drewkerr
drewkerr / get-focus-mode.js
Last active April 23, 2024 12:34
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
@nathan-osman
nathan-osman / build-qt5
Last active April 23, 2024 12:33
This script provides an easy way to build Qt5 for both 32 and 64-bit Windows. This script assumes that the Mingw-w64 compilers are installed on the host as well as Perl.
#!/bin/bash
#===========================================
# Download URLs for the required libraries.
#===========================================
# NOTE: if you add a URL here, you also need to add it to the
# $packages_to_build list to ensure the proper order.
declare -A urls=(
@guwidoe
guwidoe / GetLocalOneDrivePath.bas.vb
Last active April 23, 2024 12:33
VBA Function to get the local path of a OneDrive/SharePoint synchronized Microsoft Office file
'Attribute VB_Name = "GetLocalOneDrivePath"
'
' Cross-platform VBA Function to get the local path of OneDrive/SharePoint
' synchronized Microsoft Office files (Works on Windows and on macOS)
'
' Author: Guido Witt-Dörring
' Created: 2022/07/01
' Updated: 2024/04/23
' License: MIT
'
@richardpl
richardpl / drcbox.lua
Last active April 23, 2024 12:31
dynaudnorm filter with visual feedback
--[[
mpv dynaudnorm filter with visual feedback.
Copyright 2016 Avi Halachmi ( https://github.com/avih )
Copyright 2020 Paul B Mahol
License: public domain
Needs mpv with very recent FFmpeg build.
Default config:
@mbostock
mbostock / .block
Last active April 23, 2024 12:30
Hierarchical Edge Bundling
license: gpl-3.0
height: 960
border: no
redirect: https://observablehq.com/@d3/hierarchical-edge-bundling
console.clear();
function saveData(blob, fileName)
{
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
var url = window.URL.createObjectURL(blob);
a.href = url;
@dabodamjan
dabodamjan / MailComposeViewController.swift
Last active April 23, 2024 12:28
Sending a contact us email on iOS 14 (can be also used with SwiftUI)
//
// Feel free to use this code in your project.
// Inspired by SO answer https://stackoverflow.com/a/65743126
// Uses DeviceKit as a dependency https://github.com/devicekit/DeviceKit
//
import Foundation
import MessageUI
import DeviceKit
@miguelmota
miguelmota / log
Created September 20, 2014 06:11
Fully expand object while logging in Node.js
var util = require('util');
console.log(util.inspect(myObject, {showHidden: false, depth: null}));
# alternative shortcut
console.log(util.inspect(myObject, false, null));
# stringifying alternative
console.log(JSON.stringify(myObject, null, 4));