Skip to content

Instantly share code, notes, and snippets.

View dcinzona's full-sized avatar
🏠
Working from home

Gustavo Tandeciarz dcinzona

🏠
Working from home
View GitHub Profile
@dcinzona
dcinzona / ping_check.py
Last active July 18, 2023 04:06
connection-check
import os
import time
def write_to_log(log_message):
with open('network_status.log', 'a') as log_file:
log_file.write(log_message + '\n')
def is_connected():
if os.name == 'nt':
return is_connected_win()
#!/usr/bin/env python3
"""
Author: Teddy Xinyuan Chen
Date: 2020-08-17
"""
from functools import cache
from pathlib import Path
from subprocess import run
import re
@dcinzona
dcinzona / scrape_wayback.py
Last active November 21, 2022 14:28
A quick and dirty python script I used to pull down all my old images from the web.archive.org cache of my ghost blog after losing them during a server migration...
import re
import requests
from bs4 import BeautifulSoup
import os
SITE = "https://tandeciarz.com"
# this will end up being the archive URL
AURL = SITE
# timestamp for date before the snapshot I want to scrape
ts = "20221010"
@dcinzona
dcinzona / headMarkup.js
Last active December 6, 2022 18:21
Salesforce Communities multi-language omnistudio fix
//find the sessionStorage key that contains the UserLocale value
function getOmniLangKey(){
for(let i=0; i<sessionStorage.length; i++){
let key = sessionStorage.key(i);
if (key === 'LSSIndex:SESSION{"namespace":"omnistudio"}'){
let omniSession = JSON.parse(sessionStorage.getItem(key));
return omniSession.userLocale
}
}
return null;
@dcinzona
dcinzona / monitor.py
Last active November 10, 2022 16:49
Monitor network connectivity to the internet via python
import os
import socket
import datetime
import time
FILE = os.path.join(os.getcwd(), "networkinfo.log")
DBG = False
@dcinzona
dcinzona / VisualForcePageUsage.vfp
Created April 22, 2022 16:29
Visualforce Page Metrics
<!--
- Created by gtandeciarz on 6/21/17.
-->
<apex:page id="VisualForcePageUsage"
title="VisualForce Page Metrics"
readOnly="true"
standardStylesheets="false"
>
<!--
@dcinzona
dcinzona / readlog.py
Last active February 3, 2022 22:43
Saleforce Log File SOQL Query parser
"""
Run via command line: python3 readlog.py [logfile] [optional:outputfilecsv]
Requires Python 3.6 or higher
"""
import os,sys,re,traceback
#import Operations.Operation as Operation
"""
15:05:12.412 (20450194753)|CODE_UNIT_STARTED|[EXTERNAL]|Flow:01Ir0000000HCxR
15:05:12.412 (20747809148)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:01Ir0000000HCxE
15:05:12.893 (21137018664)|CODE_UNIT_STARTED|[EXTERNAL]|Validation:PersonAccount:001r000000l8CIV
@dcinzona
dcinzona / MakePowerShellRememberSSHPassphrase.md
Created December 11, 2021 16:44 — forked from yevhen/MakePowerShellRememberSSHPassphrase.md
How to make Powershell remember the SSH key passphrase.

You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:

  1. Start the ssh-agent from Windows Services:
  • Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window;
  • Find the OpenSSH Authentication Agent in the list and double click on it;
  • In the OpenSSH Authentication Agent Properties window that appears, choose Automatic from the Startup type: dropdown and click Start from Service status:. Make sure it now says Service status: Running.
  1. Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
- plugin: snowfakery.standard_plugins.Salesforce.SOQLDataset
- plugin: snowfakery.standard_plugins.Salesforce.SalesforceQuery
- include_file: account.macro.yml
- object: Account
include: account
fields:
__user:
SOQLDataset.shuffle:
#SalesforceQuery.random_record:
fields: Id
@dcinzona
dcinzona / findFields.sh
Last active September 17, 2021 18:50
Search XML for Salesforce Fields (Flows)
#!/bin/sh
# Purpose: Parse Salesforce XML / Flows to find fields referenced in an input CSV
# Fields CSV Format:
# sobject,fieldApi,ObjectLabel,FieldLabel,PerformFunctionalAssessment
# Author: Gustavo Tandeciarz
# Requires: xmlstarlet (brew install xmlstarlet)
# execution to parse flows: ./findFields.sh fields.csv ./src/flows
# ------------------------------------------