Skip to content

Instantly share code, notes, and snippets.

View AntonFriberg's full-sized avatar
🕹️
Automating database migrations

Anton Friberg AntonFriberg

🕹️
Automating database migrations
  • Axis Communications
  • Lund, Sweden
  • 20:11 (UTC +02:00)
  • LinkedIn in/antonfriberg
View GitHub Profile
@AntonFriberg
AntonFriberg / create_event_from_email.gs
Created July 14, 2023 15:24
Create Event from Booking Email using Google App Scripts
// What to add to the parsed ISO date to get it in correct timezone
TZ_POSTFIX = 'T00:00:00+02:00';
// Email subjects to look at
SUBJECT_NEW_BOOKING = 'New Booking - Some Service';
// Matches '2023-07-14 00:00 - 2023-07-14 00:00' like strings with groups for each date
DATE_RANGE_PATTERN = new RegExp('(\\d{4}-\\d{2}-\\d{2}) 00:00 - (\\d{4}-\\d{2}-\\d{2}) 00:00');
// Regex patterns to extract other content such as name, apartment, email
NAME_PATTERN = new RegExp('<td>Name:<\\/td>[\\n\\s]+<td>(.*)<\\/td>');
APARTMENT_PATTERN = new RegExp('<td>Apartment:<\\/td>[\\n\\s]+<td>(.*)<\\/td>');
EMAIL_PATTERN = new RegExp('<td>Email:<\\/td>[\\n\\s]+<td>(.*)<\\/td>');
@AntonFriberg
AntonFriberg / ssht.fish
Created March 5, 2024 13:04
Fish function for transferring terminfo to remote server over ssh
function ssht
# Set the remote server's address
set remote_server $argv[1]
# Export the terminal info to a temporary file
set tmp_file (mktemp)
infocmp >$tmp_file
# Transfer the terminfo file to the remote server
scp $tmp_file $remote_server:/tmp/