Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael G. Ströck mstroeck

View GitHub Profile
@mstroeck
mstroeck / Subfolder to git repo.md
Last active Sep 19, 2015 — forked from korya/Subfolder to git repo.md
Convert subfolder into Git submodule
View Subfolder to git repo.md
@mstroeck
mstroeck / satis_github_auth.sh
Last active Feb 8, 2019 — forked from h4cc/satis_github_auth.sh
Some notes on how to authenticate with composer/satis against github oauth, so the rate limit of 60 will be raised op to 5000. Can also be used for travis-ci.
View satis_github_auth.sh
# Create a new Token
curl -u 'githubuser' -d '{"note":"Your Application"}' https://api.github.com/authorizations
# It is: "ebab4dc37e654bb230a9c69ebcd5f38e9a81e210"
#{
# "created_at": "2013-01-04T18:00:28Z",
# "app": {
# "url": "http://developer.github.com/v3/oauth/#oauth-authorizations-api",
@mstroeck
mstroeck / gist:5d67d97fede26a69852b
Created Aug 21, 2014
Mailbox Betacoin Mailing Source
View gist:5d67d97fede26a69852b
Delivered-To: michael@stroeck.com
Received: by 10.152.6.135 with SMTP id b7csp766829laa;
Thu, 21 Aug 2014 02:32:40 -0700 (PDT)
X-Received: by 10.50.115.73 with SMTP id jm9mr2899754igb.3.1408613554382;
Thu, 21 Aug 2014 02:32:34 -0700 (PDT)
Return-Path: <pm_bounces@pm.mtasv.net>
Received: from sc-ord-mta118.mtasv.net (sc-ord-mta118.mtasv.net. [50.31.156.118])
by mx.google.com with ESMTPS id h1si29180296icz.77.2014.08.21.02.32.33
for <michael@stroeck.com>
View bootstrap.flatten.css
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
View grep-with-git.vim
" This is the grep command I've always wanted.
" This plugin opens the results of 'grep -r' in a bottom window
" and uses 'git grep' when in a git repo and regular grep otherwise.
" <C-x><C-x> runs grep for the word under the cursor
" :G <word> runs grep
" :Gi <word> runs grep as case-insensitive
function! Grep(args, ignorecase)
let grepprg_bak=&grepprg
@mstroeck
mstroeck / gist:3804272
Created Sep 29, 2012 — forked from zbowling/gist:3318310
Mountain Lion "locate" fix.
View gist:3804272

One of my favorite commands on most unix systems is the locate command which ships with the system. After upgrading Apple seems to have completely broken it.

It appears the built /usr/libexec/update.localdb script looks for a nobody user on Mountain Lion (this is the same version of this script since Snow Leopard). This user seems to be missing after an in-place Mountian Lion upgrade but may be missing in regular installs as well. Apple didn't seem to check to see if the locate script (Apple use's the version from FreeBSD) still worked after changing the default users in the local ldap on your machine. The locate.update script needs the user id for "nobody" to mark as the owner of the database files it creates.

Instead of modifying this script I found it easier to bring back the nobody user. This also fixes mysql upgrades from lion as well.

(nobody user on Lion was user 13)

sudo dscl . -create /Users/nobody
@mstroeck
mstroeck / optimizeimages.sh
Created Aug 15, 2012 — forked from Munter/optimizeimages.sh
Shell script to recursively optimize all image in the current directory. WARNING: THIS OVERWRITES YOUR ORIGINALS AND REMOVES METADATA!
View optimizeimages.sh
#!/bin/sh
set -o errexit
PNGS=`find . -iname "*.png"`
JPGS=`find . -iname "*.jpg"`
TMP1="_TMP1.PNG"
TMP2="_TMP2.PNG"
echo "Optimizing PNG"
for PNG in ${PNGS}
View git-cache-meta.sh
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
# 2012-03-05 - added filetime, andris9
View unbounce-webhook-email.php
<?php
// This is a sample PHP script that demonstrates accepting a POST from the
// Unbounce form submission webhook, and then sending an email notification.
function stripslashes_deep($value) {
$value = is_array($value) ?
array_map('stripslashes_deep', $value) :
stripslashes($value);
return $value;
}
@mstroeck
mstroeck / rds_backup.sh
Created Jun 9, 2012 — forked from jlbelmonte/rds_backup.sh
RDS Backup Script
View rds_backup.sh
#!/bin/bash
SNAPID="SNAP"
BACKUPDBID="TEMPDB"
#config groups
SECURITYGROUP="Mysecgrup"
PARAMSGROUP="Myparamsgrup"
#rds verifying commands