Skip to content

Instantly share code, notes, and snippets.

@salewski
salewski / dot-emacs-snippet-maximize-window-vertically.el
Last active September 21, 2020 07:00
Provides function 'ads/maximize-window-vertically', plus a suggested key binding.
;; SPDX-FileCopyrightText: <text> © 1985, 1989, 1992-1994, 2000-2020 Free Software Foundation, Inc.
;; © 2020 Alan D. Salewski <ads@salewski.email> </text>
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;; This file IS NOT part of GNU Emacs, but it is derived from the function
;; `maximize-window', which IS part of GNU Emacs. At the time of writing
;; (2020-08-27) the `maximize-window' function is defined in the Emacs file
;; 'window.el':
;;
@salewski
salewski / some-program-file
Last active January 6, 2024 02:16
These /are/ the droids you're looking for.
# SPDX-FileCopyrightText: <text>
# © 2024 Alan D. Salewski <ads@salewski.email>
# </text>
#
# SPDX-License-Identifier: GPL-2.0-or-later
@salewski
salewski / compressing-unicode-names.md
Created July 23, 2020 20:07 — forked from js-choi/compact-unicode-character-names.md
Succinct Unicode character names

Compressing the Unicode names lists

Perhaps the most prominent, if not the most important, property of any Unicode character is its name. These immutable labels are much more descriptive than their hexadecimal codes.

But these names aren’t used often in most programming languages. Why is that? Perhaps the biggest reason why is the [sheer size of the list of names][UnicodeData.txt], weighing 1.769 MB; embedding such a file in every language runtime would impose a large burden on resource-constrained environments such as mobile devices. But can this burden be mitigated with data compression? How compressible is this list? Can we create a [succinct data structure][succinct] from this list?

Precedent for this project comes from GNU Uniname, a GNU Project utility, written by Bill Poser of British Columbia, which can look up the characters of names and the names of characters. Its source may be read in [uniname.c][] and [test-uninames.c][]. According to its documentation, the size of the compiled program

@salewski
salewski / dot-gitconfig-snippet-add-alias-ads-push-all-from-upstream.ini
Last active May 6, 2020 16:38
Provides two new git aliases: 'ads-push-all-from-upstream' and 'ads-push-all-from-upstream-force'
# -*- conf-unix -*-
# snippet for your ~/.gitconfig file
# provides two new git aliases:
# * ads-push-all-from-upstream
# * ads-push-all-from-upstream-force
# ...
[alias]
# ...
# Downloads and unpacks (in subdirs of the current directory) all of the
# Debian source packages associated with the *-dbgsym and *-dbg packages whose
# symbols are referenced by the specified program ('/usr/bin/someprogram' in
# the snippet below). Takes pains to ensure the downloaded source packages are
# at the exact same version number as the corresponding *-dbgsym/*-dbg
# packages.
#
# Assumes you are in the directory beneath which you would like the sources to
# be unpacked (by 'apt-get source'). Each unique package will have a separate
# subdirectory. We are not clever about avoiding duplicates, but 'apt-get source'
;; The variable ‘emacs-major-verseion’ and the variable ‘emacs-minor-version’
;; both first existed in GNU Emacs 19.23.
;;
;; Since GNU Emacs 24.3, the function ‘toggle-read-only’ is obsolete; the
;; recommendation is to use the function ‘read-only-mode’ instead. Note that
;; ‘read-only-mode’ is, by default, set to "C-x C-q", but I’ve got 20+ years
;; of muscle memory in my hands that want to use "C-c r" to toggle the
;; "read-onlyness" of the buffer.
;;
;; See also the function ‘view-mode’ and the variable ‘view-read-only’; having
@salewski
salewski / dot-emacs-snippet-org-CREATED
Last active November 16, 2019 18:43
emacs org-mode: insert "CREATED" date and timestamp when creating new TODOs
;; I've customzied `org-log-note-headings' to add a 'created' heading. This
;; allows us to have a 'CREATED' timestamp automatically inserted into the
;; LOGBOOK when creating a new TODO item.
;;
;; This technique learned from:
;;
;; http://lists.gnu.org/archive/html/emacs-orgmode/2009-11/msg00914.html
;;
;; for TODOs created in the buffer
;;
@salewski
salewski / sshtranger_things.py
Created February 10, 2019 15:36 — forked from mehaase/sshtranger_things.py
SSHtranger Things Exploit POC
'''
Title: SSHtranger Things
Author: Mark E. Haase <mhaase@hyperiongray.com>
Homepage: https://www.hyperiongray.com
Date: 2019-01-17
CVE: CVE-2019-6111, CVE-2019-6110
Advisory: https://sintonen.fi/advisories/scp-client-multiple-vulnerabilities.txt
Tested on: Ubuntu 18.04.1 LTS, OpenSSH client 7.6p1
We have nicknamed this "SSHtranger Things" because the bug is so old it could be
@salewski
salewski / cli.sh
Created January 15, 2019 21:55 — forked from restump/cli.sh
Register AMI with SRIOV and ENA
aws ec2 register-image --ena-support --sriov-net-support simple --virtualization-type hvm --name ami-base-centos --block-device-mappings '[{"DeviceName":"/dev/sda1","Ebs":{"SnapshotId":"snap-05168016823a3fc9f"}}]' --root-device-name /dev/sda1 --architecture x86_64 --profile rdc-com-production
aws ec2 create-tags --tags Key=OS,Value=CentOS Key=Application,Value=base --resources ami-423a593d --profile rdc-com-production
@salewski
salewski / cisco-asa-config.txt
Created July 28, 2018 16:50 — forked from benders/cisco-asa-config.txt
Getting Amazon VPC up and running with Cisco ASAs can be a pain. This is the config that we used to make it work.
! --------------------------------------------------------------------------------
! This example configuration shows what WE did to get Amazon VPC working with our
! ASAs. We use version 8.3(1). This config has not been reviewed or otherwise
! blessed in any way by anyone at Amazon. YMMV.
!
! It differs from Amazon's supplied config by using two different sets of
! crypto maps and ACLs, so it brings both tunnels up simultaneously.
!
! For the purposes of the example, the physical datacenter network is 172.16.1.0/24
! and the VPC is 10.0.0.0/16.