Skip to content

Instantly share code, notes, and snippets.

View maxkramer's full-sized avatar

Max Kramer maxkramer

View GitHub Profile
@maxkramer
maxkramer / Daily Server Reporting
Last active December 16, 2015 00:49
Daily server reporting via email. Make sure you add a cron job to run it, and edit all of the email addresses! e.g. 59 23 * * * /home/max/dailyreport.sh > /dev/null 2>&1
#!/bin/bash
apt-get update
(
echo To: [email protected]
echo From: reporting@`hostname`
if [ "$( df -h | grep hda1 | cut -c40-42)" -ge "80" ]; then echo Subject: Production Server : Low Disk Space : Daily reporting for `date +%e\ %B\ %Y`
else echo Subject: Production Server: Daily reporting for `date +%e\ %B\ %Y`
fi
echo Reporting of Production Server: `hostname`
echo
@maxkramer
maxkramer / gist:5561443
Created May 11, 2013 21:12
Perform block on main thread
static void performOnUIThread(void (^Block)()) {
dispatch_async(dispatch_get_main_queue(), Block);
}
#!/bin/sh
cd /Volumes/Cerberus;
now = $(date +"%m_%d_%Y");
mkdir "Backup_$now";
cd "Backup_$now";
cp ~/ ./;
@maxkramer
maxkramer / gist:7619326
Last active December 29, 2015 05:09
All screenshots and no gists makes James unhappy.
var renderError = function(res, error) {
res.status = 404;
res.render('error', {
title: 'Error',
error: error
});
};
exports.findWithId = function(req, res) {
var Article = mongoose.model('Article');
.article
h2
a
color: #3a9fbf
-o-transition: .3s
-ms-transition: .3s
-moz-transition: .3s
-webkit-transition: .3s
transition: .3s
a:hover
@maxkramer
maxkramer / gist:7709840
Created November 29, 2013 18:17
URL for finding out details about any application on the app store providing that you know the bundle ID (com.xxxxx.xxxxx)
http://itunes.apple.com/lookup?bundleId=com.xxxx.xxxx&country=GB&lang=en
NSLayoutConstraint *widthConstraint = [NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
NSLayoutConstraint *heightConstraint = [NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeHeight multiplier:1.0 constant:-CGRectGetHeight(self.searchBar.frame)];
NSLayoutConstraint *leftConstraint = [NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeLeft relatedBy:0 toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
NSLayoutConstraint *bottomConstraint = [NSLayoutConstraint constraintWithItem:self.tableView attribute:NSLayoutAttributeBottom relatedBy:0 toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.tableView setTranslatesAutoresizingMaskIntoCons
#!/bin/bash
for file in exports/*.html
do
name=${file##*/}
base=${name%.html}
pandoc -s "$file" -o exports/"${base}.docx"
done
pod keys set AdyenDevelopmentKey "10001|A44D1586175C4995889E6CA8701762200F7925D809ED767C888084E3B9C47844FBF1247BCC7BA35151AF40DB27BEA715CEDB008756201920F4F5F68EEEBCA0C3D43CC2DFBB25161BB5DD406A7DEFFDCF4C263E5B5FE34150DA81D4FE43CEF64E19C9B8A963E508B61314AE2EE1F3FADE72A86CA24DA706BAEE784165BA7F9169D39ADB501CA0B8B74B2FC9AC66B7B29DA030513D4087B998F0BB06F5FE67E7595B4328726541815EBA1CCCC7CAB0212BCBF3E3C1BE67F8E4B2EE41307271D8225972F942271B3E2A9DE1E272A373BE19CCBDF82273FEC88E2FAAF04C86184CC0778763658E2D2D16478FB02EA18B00DCCA7212DB81B4B7921ABEE1167117220D" ProjectS
pod keys set AdyenStagingKey "10001|A44D1586175C4995889E6CA8701762200F7925D809ED767C888084E3B9C47844FBF1247BCC7BA35151AF40DB27BEA715CEDB008756201920F4F5F68EEEBCA0C3D43CC2DFBB25161BB5DD406A7DEFFDCF4C263E5B5FE34150DA81D4FE43CEF64E19C9B8A963E508B61314AE2EE1F3FADE72A86CA24DA706BAEE784165BA7F9169D39ADB501CA0B8B74B2FC9AC66B7B29DA030513D4087B998F0BB06F5FE67E7595B4328726541815EBA1CCCC7CAB0212BCBF3E3C1BE67F8E4B2EE41307271D8225972F942271B3E2A9DE1E272A373BE19CCBDF8227

Keybase proof

I hereby claim:

  • I am maxkramer on github.
  • I am maxkramer (https://keybase.io/maxkramer) on keybase.
  • I have a public key ASB5Ohj2o3gCAuh_5WdctOOk64aFTnktzZrUTnE8tO33-wo

To claim this, I am signing this object: