Skip to content

Instantly share code, notes, and snippets.

Avatar
🇺🇲
Focusing

Andy Potanin andypotanin

🇺🇲
Focusing
View GitHub Profile
@andypotanin
andypotanin / traffic.sh
Created Jun 27, 2020 — forked from radu-gheorghe/traffic.sh
bash script for checking out traffic via /proc/net/dev
View traffic.sh
#!/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))
View sort-discussion-board.js
var _thing = {};
jQuery('.student_context_card_trigger').each(function() {
var _name = jQuery(this).text().trim();
_thing[ _name ] = _thing[ _name ] || 0;
_thing[ _name ]++;
});
//_thing.sort();
//console.log(_thing);
View web-agency-taglines.txt
Award Winning Firm with 750+ Clients
Your partner for digital growth
Expertly Crafted Disruption
Best of Breed Websites & Mobile APPS since 1998
Get More Customers
An Amazing Digital Experience
Supplying Arms for the Digital Revolution
Ready For Any Challenge
Website and App Design and Development
Stand Out In The Forest With Black Bear Design
View cloudfront-guide-and-cheatsheet.md

It helps to identify the type of content we will have.

  1. Content Pages - change often, most likely will have different content based on host
  2. Static Assets - scripts, styles and images. always same, even if host changes. See example #1
  3. Administrative Areas - require login and special cookies to be allowed.
  4. API and RPC - dont require cookies but should not be cached

For most dynamic pages that following headers should be allowed:

View disable-slow-wordpress-stuff.php
<?php
add_filter( 'postmeta_form_keys', function() { return array(); });
add_filter( 'media_library_months_with_files', function() { return array(); });
add_filter( 'media_library_show_audio_playlist', function() { return false; });
add_filter( 'media_library_show_video_playlist', function() { return false; });
View extend-with-title.js
/**
*
*/
(function(doc, require, _) {
//console.log( 'extend-with-title.js', require( 'util' ).inspect( arguments[0], { showHidden: false, depth: 2, colors: true } ) );
_.extend( doc, {
'new_title': 'modified title again!!'
});
View layouts-sample.json
{
"title": "Layouts Directory",
"items": [
{
"id": "beautifully-baked",
"slug": "beautifully-baked",
"title": "Beautifully Baked",
"description": "",
"preview": "http://layouts.siteorigin.com/layout/beautifully-baked/",
"screenshot": "http://s.wordpress.com/mshots/v1/http%3A%2F%2Flayouts.siteorigin.com%2Flayout%2Fbeautifully-baked%2F?w=400",
@andypotanin
andypotanin / git-deploy.sh
Created Oct 21, 2016
Put into a directory that is in $PATH. Then run "git deploy {branch}" to push current branch into it.
View git-deploy.sh
#!/usr/bin/env bash
## Deploy branch into "develop" branch
##
## Usage:
##
## git deploy production
##
## Save Original Branch
View coreos.cloudinit.sh
#!/bin/bash
##
## curl -s -H "cache-control:no-cache" -H "pragma:no-cache" "https://gist.githubusercontent.com/andypotanin/83910a6477effe3f9e1186784c2a7206/raw/coreos.cloudinit.sh?v=1" | sudo bash;
METADATA_URL="http://169.254.169.254/computeMetadata/"
TMPFILE=$(mktemp /tmp/XXXXXX-cloud-init)
if [[ $? -ne 0 || ! -f "${TMPFILE}" ]]; then
echo "Failed to create temp file for user-data" >&2
exit 1