Skip to content

Instantly share code, notes, and snippets.

View azatoth's full-sized avatar

Carl Fürstenberg azatoth

  • Purple Scout AB
  • Malmö
View GitHub Profile
#!/usr/bin/perl
use strict;
use warnings;
use v5.18;
use Config::General;
use File::Find::Wanted;
use File::Slurp;
var path = require('path');
var Q = require('q');
Q.longStackSupport = true;
module.exports = function (Content) {
Content.observe('before save', (ctx, next) => {
function getOldContent(name, pathId, counter, cb) {
var parsed = path.parse(name);
var filename = counter === 1 ? name : `${parsed.name} (${counter})${parsed.ext}`;
Path.find = function (filter, options, callback) {
var PrivMgr = app.PrivilegeManager;
if (!callback) {
callback = options;
}
callback = callback || ldjutils.createPromiseCallback();
var cfg = Path.app.get('cache');
var _memCache = cacheManager.caching(cfg);
var key = `path_${JSON.stringify(filter)}`;
_memCache.wrap(key, (cacheCallback) => {
@azatoth
azatoth / current.js
Last active December 4, 2020 21:52
Current TFRs for SpaceX in Boca Chica
const fetch = require("node-fetch");
const date_fns = require("date-fns");
const date_fns_tz = require("date-fns-tz");
const indentString = require("indent-string");
const chalk = require("chalk");
const params = new URLSearchParams({
searchType: "0",
designatorsForLocation: "ZHU",
offset: "0",
@azatoth
azatoth / grammar.ne
Last active April 25, 2023 14:22
Nearly grammer for TFRs
@{%
const { DateTime } = require("luxon");
%}
@builtin "postprocessors.ne"
@builtin "whitespace.ne"
notam -> "!" prefix __
notam_id __
airspace __
part:? _
@azatoth
azatoth / git-delete-gone-branches
Last active December 2, 2022 13:27 — forked from GrayedFox/git-glean
Remove local branches with a missing (gone) upstream
#!/usr/bin/env bash
# reset environment variables that could interfere with normal usage
unset GREP_OPTIONS
#
# check whether current directory is inside a git repository
#
is_git_repo() {
git rev-parse --show-toplevel >/dev/null 2>&1