This file contains 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
<?php | |
/* | |
When using a current PHP version, class-phpmailer.php:validateAddress() uses a complex regex ("pcre8") for email address validation. | |
PHP < 7.3 uses libpcre 8.x. | |
PHP 7.3 uses libpcre2 10.x. | |
Due to a bug in libpcre2 < 10.32-RC1 https://bugs.exim.org/show_bug.cgi?id=2300, | |
this email regex validation fails in PHP 7.3 with PCRE_VERSION < 10.32. |
This file contains 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 | |
# https://askubuntu.com/a/1033956/25639 | |
set -e -u | |
wget -qO- https://packages.microsoft.com/keys/microsoft.asc \ | |
| sudo apt-key add - | |
echo 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017 xenial main' \ | |
| sudo tee /etc/apt/sources.list.d/mssql-server.list |
This file contains 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 | |
# Usage: | |
# $ vddiff -U4 before after -ftsv | |
# You can toggle between the before/after sheets with Ctrl-^ | |
# If you keyboard layout makes that impossible to type, add an | |
# alternative binding to your ~/.visidatarc, e.g. | |
# bindkey("ø", "prev-sheet") |
This file contains 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
javascript:(function()%7B(function%20()%20%7Bvar%20i%2C%20elements%20%3D%20document.querySelectorAll('body%20*')%3Bfor%20(i%20%3D%200%3B%20i%20<%20elements.length%3B%20i%2B%2B)%20%7Bif%20(getComputedStyle(elements%5Bi%5D).position%20%3D%3D%3D%20'fixed')%20%7Belements%5Bi%5D.parentNode.removeChild(elements%5Bi%5D)%3B%7D%7D%7D)()%7D)() |
This file contains 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/gawk -f | |
# awk script for converting an iCal formatted file to a sequence of org-mode headings. | |
# this may not work in general but seems to work for day and timed events from Google's | |
# calendar, which is really all I need right now... | |
# | |
# usage: | |
# awk -f THISFILE < icalinputfile.ics > orgmodeentries.org | |
# | |
# Note: change org meta information generated below for author and | |
# email entries! |
This file contains 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
#!python3 | |
import imaplib | |
import os | |
import asyncio | |
loop = asyncio.get_event_loop() | |
conf = [x.strip().split() for x in open('mbsyncrc')] |
This file contains 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
-- From https://twitter.com/GabrielG439/status/647601518871359489 | |
:set -package ad | |
:set -package numbers | |
:m Numeric.AD Data.Number.Symbolic | |
diff (\x -> sqrt x) (var "a") | |
-- 1.0/(2.0*sqrt a) | |
diff (\x -> x^2 + sqrt x) (var "a") | |
-- a+a+1.0/(2.0*sqrt a) | |
diff (\x -> x^2 + sqrt x) 1 |
This file contains 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
(defun my-purple-ReceivedImMsg-handler (_num0 nick msg _num1 _num2) | |
"Handle ReceivedImMsg from Purple dbus service. | |
NICK and MSG go into an alert, other arguments ignored." | |
(let ((msg-rendered | |
(if (fboundp 'libxml-parse-html-region) | |
(with-temp-buffer | |
(insert msg) | |
(shr-render-region (point-min) (point-max)) | |
(buffer-string)) | |
msg))) |
This file contains 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
export TMUX_SESSION= | |
if [[ -n ${TMUX+set} ]]; then | |
TMUX_SESSION=$(tmux display-message -p "#S") | |
# can end up wrong if I move a pane to a different session, but I rarely do that | |
if [[ -n ${TMUX_SESSION+set} ]]; then | |
[[ -d ~/.bash_history.d ]] || mkdir -p ~/.bash_history.d | |
export HISTFILE="$HOME/.bash_history.d/${TMUX_SESSION%% *}" | |
[[ -f $HISTFILE && -n $HISTFILE ]] || cp "$HOME"/.bash_history "$HISTFILE" | |
fi | |
fi |
This file contains 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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Applicative | |
import Data.Attoparsec.ByteString | |
import qualified Data.ByteString as S | |
import Data.Char (ord) | |
import GHC.Word (Word8) | |
import Prelude hiding (takeWhile) |