Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am fortran01 on github.
  • I am fortran01 (https://keybase.io/fortran01) on keybase.
  • I have a public key ASDAq43cA9c36E5l348wPMzQt6ML9ixXyViUGMEU1W9mGAo

To claim this, I am signing this object:

@fortran01
fortran01 / AuthyToOtherAuthenticator.md
Created March 27, 2020 18:55 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

% RESUME DOCUMENT STYLE -- Released 23 Nov 1989
% for LaTeX version 2.09
% Copyright (C) 1988,1989 by Michael DeCorte
\typeout{Document Style `resume' <26 Sep 89, Dec 07>.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% resume.sty
%
% \documentstyle{resume}
#!/bin/bash
# Use expect to automate ssh login
# Usage: test_ssh.sh user host password
function _ssh {
USER=$1
HOST=$2
PASS=$3
/usr/bin/expect <<- EOD
set timeout 30
log_user 1
#!/usr/bin/expect
set USER [lindex $argv 0]
set HOST [lindex $argv 1]
set PASS [lindex $argv 2]
log_file -a ~/scp.log
set timeout 30
log_user 1
set send_slow {1 .01}
send_log "spawn scp"
eval spawn scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=30 /tmp/test.txt $USER@$HOST:~/

If the source computer (the one initiating the WinRM access) is not domain-joined, but the target computer is domain-joined, you can still use WinRM to access the target computer with domain credentials.

In this scenario, you need to ensure that the following configurations are in place:

  1. Make sure WinRM service is enabled and running on the target computer. On the target computer, open an elevated PowerShell prompt and run:
Enable-PSRemoting -Force
@fortran01
fortran01 / scraper.sh
Last active March 31, 2023 18:03
Scrape SickKids research site and email
(curl 'https://research4kids.research.sickkids.ca/findaclinicalresearchstudy' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Origin: https://research4kids.research.sickkids.ca' \
-H 'Referer: https://research4kids.research.sickkids.ca/findaclinicalresearchstudy' \
--data-raw 'selectedResearchTopics=&researcherId=&departmentId=&searchKeyWord=Allergy&search=Search' \
--compressed > output.html \
&& perl -i -pe 's|(?<=href=")(/[^"]+)|https://research4kids.research.sickkids.ca$1|g' output.html \
&& echo -e "To: your@email.com\nFrom: your@email.com\nSubject: Clinical Research Study Results\nMIME-Version: 1.0\nContent-Type: text/html\n\n$(cat output.html)") \
| /opt/homebrew/bin/msmtp -a gmail your@email.com
from time import sleep
import requests
import datetime
# Get the store open dates for the next n days
def get_open_dates(start_date, store_id, num_days):
url = f"https://www.kaltire.com/on/demandware.store/Sites-Kaltire-Site/default/Appointment-GetStoreOpenDatesByDate?startDate={start_date}&storeID={store_id}&numDays={num_days}&serviceId=2731"
headers = {
'authority': 'www.kaltire.com',
'accept': 'application/json, text/javascript, */*; q=0.01',
@fortran01
fortran01 / fetch_ts.py
Last active January 8, 2024 19:07
Fetch machine-stats time-series data from the Tidal platform
import json
import os
import pandas as pd
testing_flag = False # Set to True to only fetch data for the first two servers with machine stats
def list_servers_without_machine_info(df_servers):
df_servers_without_machine_info = df_servers[
df_servers['ram_allocated_gb'].isna()
| df_servers['storage_allocated_gb'].isna()
@fortran01
fortran01 / update_ip.sh
Created September 22, 2023 15:06
Updates the IP in Ubuntu based on netplan
#!/bin/bash
echo "Available network interfaces:"
ip link show | awk -F: '$0 !~ "lo|vir|wl|^[^0-9]"{print $2;getline}'
read -p "Choose the network interface to modify (e.g., enp0s3): " INTERFACE
echo "Available netplan configuration files:"
ls /etc/netplan
read -p "Choose the netplan configuration file to modify (e.g., 01-netcfg.yaml): " NETPLAN_FILE