Skip to content

Instantly share code, notes, and snippets.

View andypotanin's full-sized avatar
🇺🇲
Focusing

Andy Potanin andypotanin

🇺🇲
Focusing
View GitHub Profile
@jackcoldrick90
jackcoldrick90 / associateContactToCompany.js
Last active March 27, 2024 08:28
This custom code snippet can be used to associate a contact to a company based on the company name property that is stored at a contact level. It's particularly useful if your customers are using a freemail address and aren't supplying a company website - just the name of their company. If no company is found a new record will be created in the …
// Import the Hubspot NodeJS Client Library - this will allow us to use the HubSpot APIs
const hubspot = require('@hubspot/api-client');
/*
This function is called when the custom code action is executed. It takes 2 arguements. The first is the event object which contains information on the currently enrolled object.
The second is the callback function which is used to pass data back to the workflow.
*/
exports.main = (event, callback) => {
// Instantiate a new HubSpot API client using the HAPI key (secret)
@ismaelc
ismaelc / Code.js
Created February 2, 2021 05:20
Complete Apps Script Google Sheets code for ml-classify-text-js
// Import ml-classify-text
eval(UrlFetchApp.fetch('https://cdn.jsdelivr.net/npm/ml-classify-text@2.0.0/lib/index.js').getContentText());
let classifier = new Classifier()
// Add menu items
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('ML Train Menu')
.addItem('Get training set', 'captureRange')
.addItem('Predict', 'predictRange')
@alexarje
alexarje / mxf2mp4.sh
Last active February 12, 2024 13:28
Convert MXF files to MP4 using FFmpeg
#!/bin/bash
# Script for converting MXF video files to different to other file formats.
for i in *.MXF; do
if [ -e "$i" ]; then
file=`basename "$i" .MXF`
# MP4 file with default settings + deinterlacing
ffmpeg -i "$i" -c:v libx264 -vf yadif "$file.mp4"
@random-robbie
random-robbie / uptime.py
Last active January 20, 2023 10:11
add domains from csv to uptime robot
import requests
import csv
import time
apiKey = "KEY"
def add_monitor (apiKey,domain,friendly):
@danielscholl
danielscholl / ieESC_disable
Created March 20, 2017 14:19
Disable IE Enhance Security PowerShell
function Disable-ieESC {
$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}"
$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}"
Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0
Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0
Stop-Process -Name Explorer
Write-Host "IE Enhanced Security Configuration (ESC) has been disabled." -ForegroundColor Green
}
Disable-ieESC
## export _REPO_FULL=UsabilityDynamics/www.exceedrealty.net
## curl -s --header "Authorization: token ${GITHUB_PERSONAL_TOKEN}" https://api.github.com/repos/${_REPO_FULL}/labels
# Delete default labels
curl -XDELETE -s --header "Authorization: token ${GITHUB_PERSONAL_TOKEN}" https://api.github.com/repos/${_REPO_FULL}/labels/bug
# Create New Labels
curl -XPOST -s --header "Authorization: token ${GITHUB_PERSONAL_TOKEN}" https://api.github.com/repos/${_REPO_FULL}/labels --data '{"name":"priority:low","color":"66aa00"}'
@antonkorotkov
antonkorotkov / gist:e0b7f334711bc3638ced
Created April 23, 2015 15:58
LATEST DOCKER RUNNER
<?php
include_once( __DIR__ . '/vendor/autoload.php');
/**
* Get configs
*/
$configs = json_decode(file_get_contents('https://gist.githubusercontent.com/antonkorotkov/7b7bd50ff3d9ce42c48b/raw/41936ed1462aad4e5f72816ee76d86896fb0c787/gistfile1.json'));
/**
## Check all response codes for Docker containers.
##
##
## source <(curl -s https://gist.githubusercontent.com/andypotanin/e1876800b56acc63c462/raw)
function app.check {
for app in $( docker ps -q -f=status=running ); do
_hostname=$(docker inspect -f '{{ .Config.Hostname }}' $app);
_domainname=$(docker inspect -f '{{ .Config.Domainname }}' $app);
@andypotanin
andypotanin / benchmark.php
Last active August 29, 2015 14:04
We use this to benchmark PHP in CLI.
<?php
/**
* Based off of http://www.php-benchmark-script.com/ but modified to output JSON response.
*
* wget https://gist.githubusercontent.com/andypotanin/bae0b8b40581e518e16d/raw/benchmark.php
* php benchmark.php
*
* @version 1.1.0
* @author potanin@UD
*/
@andypotanin
andypotanin / badges-_summary.md
Last active November 21, 2017 06:25
Repository Badges

Please see repository-type specific Gists for examples.

  • All repositories should have Bug, Backlog and Active (In Progress) labels via Waffle.io to hep quickly grasp state of repository.
  • Code Quality and Climate badge should be done via either Scrutinizer (PHP) or CodeClimate (JavaScript), depending on which works better.
  • Gemnasium should be used to determine status of dependencies - it works with Composer, NPM and others.
  • CircleCI should be used in most cases, keep in mind an API token is required for each repository and must be generated in CircleCI settings. This should demonstrate if the code in the repository actually works.
  • For certain repositories custom badges (NPM, Packagist, etc.) may be used as well, when applicable.