Skip to content

Instantly share code, notes, and snippets.

View andypotanin's full-sized avatar
🇺🇲
Focusing

Andy Potanin andypotanin

🇺🇲
Focusing
View GitHub Profile
@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
*/
@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'));
/**
## 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"}'
## 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 / 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.
@radu-gheorghe
radu-gheorghe / traffic.sh
Created November 16, 2012 14:24
bash script for checking out traffic via /proc/net/dev
#!/bin/bash
#shows traffic on the specified device
function human_readable {
VALUE=$1
BIGGIFIERS=( B K M G )
CURRENT_BIGGIFIER=0
while [ $VALUE -gt 10000 ] ;do
VALUE=$(($VALUE/1000))
@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
@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')
@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):
@GianlucaGuarini
GianlucaGuarini / post-merge
Last active August 22, 2023 20:54 — forked from sindresorhus/post-merge
Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency using bower npm or composer
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}