Skip to content

Instantly share code, notes, and snippets.

View jordan8037310's full-sized avatar

Jordan Ryan jordan8037310

View GitHub Profile
@bergantine
bergantine / gist:1163864
Last active October 2, 2020 13:49
Send an email when memory hits a certain limit (Bash CRON script for Linux). #bash #cron #linux #ops
# check memory usage every 15 minutes and if usage matches 90% of allocation, send an email
# where _username_ is the username (works on Mac if -u parameter is changed to -U)
# where _webmaster@example.com_ is who should be emailed
# where MAX is the allocated memory (must be an integer)
# where LIMIT is the point at which you want to be emailed (must be an integer)
*/15 * * * * USAGEF=`ps -u _username_ -o rss,command | grep -v peruser | awk '{sum+=$1} END {print sum/1024}'`; USAGEI=${USAGEF/.*}; MAX=120; LIMIT=108; if [ $USAGEI -gt $LIMIT ]; then echo Usage \($USAGEI\) is approaching or over the maximum allocation \($MAX\) | mail -s "Server is approaching max allocation of memory." _webmaster@example.com_; fi
@benclark
benclark / local.settings.php
Last active September 29, 2015 20:48 — forked from brockboland/local.settings.php
My local settings for Drupal sites
<?php
/**
* @file
* local.settings.php (Drupal 6.x)
*
* This settings file is intended to contain settings specific to a local
* development environment, by overriding options set in settings.php.
*
* Include this file from your regular settings.php by including this at the
* bottom:
@KartikTalwar
KartikTalwar / Documentation.md
Last active June 25, 2024 10:55
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@jakeasmith
jakeasmith / mysqldump.sh
Last active June 28, 2021 20:07
A quick snippet for doing a compressed mysql dump with a pv to monitor progress
mysqldump [database] | pv | gzip -c > [file].sql.gz
@benjifisher
benjifisher / find_commit.php
Created November 6, 2013 14:44
This php command-line script will do a binary search to find the first git commit that breaks your patch. It will give simple usage instructions if you invoke it without arguments. I wrote this script to help in re-rolling patches for Drupal. I posted the original version as a comment on https://drupal.org/patch/reroll . The script makes a reaso…
#!/usr/bin/env php
<?php
// Get the arguments. If there are not two, then print usage info.
if (count($argv) != 3) {
$scriptname = basename($argv[0]);
print("Usage: $scriptname <date> <patchfile>" . PHP_EOL);
print('where <date> is any date understood by git' . PHP_EOL);
print('and <patchfile> applied cleanly on <date>, not today.' . PHP_EOL);
print("Example: $scriptname 2013/05/17 foo.patch" . PHP_EOL);
@greenido
greenido / YT_Dashboard_Stats_For_post.js
Last active September 2, 2016 23:37
YouTube Dashboard Stats with Google Apps Script
/**
* YouTube Dashboard Stats Example
* Fetch stats on videos and channel by using YT APIs.
* 1. It using the ATOM feeds - v1.
* 2. For the channel we are using the v3 version of the API.
*
* @Author: Ido Green | @greenido | +Greenido
* @Date: Aug 2014
*
* @see:
@dj1020
dj1020 / migrate.sh
Last active February 5, 2019 13:05 — forked from tobi-pb/migrate.sh
Upgrade MAMP to Mysql 5.7 tested by Ken Lin 2015/11/09
#!/bin/sh
wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.9-osx10.10-x86_64.tar.gz
tar xfvz mysql-5.7*
echo "stopping mamp"
sudo /Applications/MAMP/bin/stop.sh
sudo killall httpd mysqld
echo "creating backup"
@yossorion
yossorion / what-i-wish-id-known-about-equity-before-joining-a-unicorn.md
Last active June 25, 2024 07:29
What I Wish I'd Known About Equity Before Joining A Unicorn

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@javilobo8
javilobo8 / download-file.js
Last active July 1, 2024 23:21
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@dustinleblanc
dustinleblanc / .lando.yml
Last active September 1, 2021 19:15
Pantheon Build Tools with Lando Behat Testing
name: some-site
recipe: pantheon
config:
framework: drupal8
env: dev
site: some-site
id: some-uuid-string-here
drush: 8.3
php: '7.3'
webroot: web