Instantly share code, notes, and snippets.
👽
secret alien technology
mucking around in the muck. This is my personal account. Work account:@markasoftware-tc
- San Francisco
- 08:01
(UTC -07:00) - https://markasoftware.com/
- https://www.strava.com/athletes/47839944
- https://www.weglide.org/user/19942
markasoftware /copy-table-to-clipboard.sh
Last activeApril 4, 2023 17:52
Copy CSV to clipboard as table, in shell This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Use input redirection. Copies straight to clipboard. | |
# Can paste into spreadsheet applications directly. | |
# MIT licensed. | |
gawk' | |
BEGIN { FPAT = "([^,]*)|(\"[^\"]+\")" } | |
NR>1 { print "" } | |
{ |
markasoftware /enterprise_token.rb
Last activeOctober 13, 2025 10:45
OpenProject Enterprise mode for free This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
############ If you are using DOCKER all-in-one image, create Dockerfile like: ################ | |
############ FROM openproject/openproject:16 ################ | |
############ COPY ./enterprise_token.rb app/models/enterprise_token.rb ################ | |
############ If you are runing a manual installation: ################ | |
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################ | |
############ also be sure to RESTART OpenProject after replacing the file. ################ | |
############ If using some other set up (eg docker-compose), read the comments on ################ | |
############ https://gist.github.com/markasoftware/f5b2e55a2c2e3abb1f9eefcdf0bfff45 ################ |
markasoftware /html.lisp
Last activeJune 16, 2024 02:08
html->string (Super simple HTML templating for Lisp) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
;; Copyright (c) 2020 Mark Polyakov | |
;; Released under the WTFPL (Do What The Fuck You Want To Public License) | |
(defvar*html-void-tags*'(:area:base:br:col:embed:hr:img:input:link | |
:meta:param:source:track:wbr) | |
"String designators for self-closing/void tags. | |
https://html.spec.whatwg.org/multipage/syntax.html#void-elements") | |
(defvar*html-escapes* | |
'(#\>">" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This file is released under the GNU Public License v3 | |
# ACM scraper during coronavirus | |
# Will skip existing PDFs to speed up a resumed download | |
# Get the link to the first issue in the journal/SIG/etc, then the scraper will use "next" links to traverse | |
# Usage: ./acm.bash first_issue_link output_dir | |
# Eg, ./acm.bash https://dl.acm.org/toc/siggraph/1969/3/3 /media/mass/siggraph to download all SIGGRAPH PDFs | |
# note: acm does BLOCK IPs after a few hundred PDFs! Uncommenting the sleep statement below to slow things down may help, but I haven't tested |
markasoftware /gist:2d64c4cf7b948b5e7a054b3e417670f9
CreatedJanuary 12, 2020 01:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
json = JSON.parse(require('fs').readFileSync('/tmp/memes', 'utf8'); | |
filter = json.filter(c=>c.points>60000); | |
min = json.sort((a,b)=>a-b)[0].points; | |
sum = json.reduce((a,b)=>a+b.points, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/sh | |
# USAGE: | |
# `backup-wordpress user@host /sth/backups-dir` (usually root) | |
# optional environment variables: | |
# WP_DB: Name of the wordpress database (default: wordpress). | |
# WP_DB_USER: User for the mysql database (default: root). | |
# WP_DB_PASSWORD: Password for mysql database (defaults to prompting). | |
# WP_WWW: Path to the wordpress files (remotely). Should be direct to the `wordpress` directory, not the general public html one (default: /var/www/wordpress). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Copyright (c) Mark Polyakov 2018 | |
# Released under the GNU GPL version 3 | |
use strict; | |
use warnings; | |
use v5.14; | |
use Cwd'abs_path'; |
markasoftware /number.sh
CreatedMay 6, 2019 21:23
Generate a file with random contents, certain length, and fixed beginning and ending characters (phone number in file size). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/sh | |
if ["$#"!= 4 ] | |
then | |
echo'USAGE: number.sh ~/my-phone-number 12065555555 o o' | |
exit 1 | |
fi | |
echo -n"$3">"$1" | |
base32< /dev/urandom| tr A-Z0-9\\n a-za-z| tr -d'='| head -c $["$2"-2]>>"$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/bash | |
foriin$(xdotool search --class Konsole) | |
do | |
xdotool windowactivate --sync"$i"type"$1" | |
xdotool windowactivate --sync"$i" key Return | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
#!/bin/bash | |
# help text | |
[[$1==*-h*||-z$1 ]]&&echo'Usage: mnemonic.sh word_count [min_length max_length]'&&exit | |
# Where is the wordlist? | |
[[-e /usr/dict/words ]]&& dict_path='/usr/dict/words'|| dict_path='/usr/share/dict/words' | |
# Remove words with apostrophes, capitalization, or outside the correct length range | |
sed -r"/^[a-z]{${2:-5},${3:-8}}$/!d""$dict_path"> /tmp/mnemonic-words | |
word_count=$(wc -l< /tmp/mnemonic-words) | |
# print estimated entropy per word |
NewerOlder