Skip to content

Instantly share code, notes, and snippets.

View mstroeck's full-sized avatar

Michael G. Ströck mstroeck

View GitHub Profile
@mstroeck
mstroeck / hack.sh
Created April 1, 2012 18:40 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
<?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 / git-cache-meta.sh
Created July 30, 2012 12:28 — forked from andris9/git-cache-meta.sh
git-cache-meta
#!/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
@mstroeck
mstroeck / gist:3804272
Created September 29, 2012 15:01 — forked from zbowling/gist:3318310
Mountain Lion "locate" fix.

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 / grep-with-git.vim
Created October 15, 2012 20:39
vim-grep-with-git
" 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 / vim-launcher.scpt
Created November 12, 2015 19:53
Use Applescript to launch files in vim via iTerm
on run {input, parameters}
set cmd to "vim -c startinsert"
if input is not in {} then
set myPath to POSIX path of input
set cmd to "vim " & quote & myPath & quote
end if
tell application "iTerm"
activate
set myTerm to (current terminal)
/* 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;
@mstroeck
mstroeck / DesktopToastsSample.cpp
Created January 13, 2016 09:02 — forked from kirancheraku/DesktopToastsSample.cpp
Persistent toast notification in Win32 app with COM server
#include "stdafx.h"
#include "ToastActivator_h.h"
using namespace Microsoft::WRL;
using namespace ABI::Windows::UI::Notifications;
using namespace ABI::Windows::Data::Xml::Dom;
using namespace Windows::Foundation;
class DECLSPEC_UUID("BD8EC9B3-CAEB-465A-B5C0-2ABA5D5839D1") CToastActivator
WrlFinal : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, INotificationActivationCallback, FtmBase>
@mstroeck
mstroeck / business-models.md
Created January 24, 2016 20:57 — forked from ndarville/business-models.md
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@mstroeck
mstroeck / default
Created May 27, 2016 20:55 — forked from DarrylDias/default
NGINX configuration for Grav CMS.
server {
listen 80;
server_name localhost; # Change this with your domain name
root /var/www/grav; # The place were you have setup your Grav install;
index index.php;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;