Skip to content

Instantly share code, notes, and snippets.

@gavrix
gavrix / gist:5054182
Created February 28, 2013 04:28
Script integrating OCLint into XCode. Put it in "Run script" build phase.
source ~/.bash_profile
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi
@fernandoaleman
fernandoaleman / gist:5083680
Last active October 17, 2023 12:02
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@mattes
mattes / wp-cli-install-with-brew.sh
Created October 18, 2013 13:45
Installing WP-CLI under Mac OS with Homebrew
#!/usr/bin/env
# curl https://gist.github.com/mattes/7041760/raw/wp-cli-install-with-brew.sh | bash
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install wp-cli
@Kartones
Kartones / postgres-cheatsheet.md
Last active August 11, 2025 08:56
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@BennettSmith
BennettSmith / .gitignore
Last active March 14, 2025 12:16
Google Protobuf v2.6.0 Build Script for iOS
protobuf
protobuf-2.6.0
protobuf-2.6.1
protobuf-master
@simlegate
simlegate / custom-error-page
Created October 31, 2014 05:35
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@kevinzhow
kevinzhow / vpnserver.sh
Last active March 19, 2019 12:59
OnClickVPNServer
#!/usr/bin/env bash
echo 'deb http://shadowsocks.org/debian wheezy main' >> /etc/apt/sources.list
# Pre-requisites
sudo apt-get -y update
sudo apt-get -y install pptpd
sudo apt-get -y install fail2ban
sudo apt-get -y install shadowsocks-libev
@jtbandes
jtbandes / Function.h
Last active April 21, 2020 16:51
fun with Obj-C "generics"
@import Foundation;
NS_ASSUME_NONNULL_BEGIN
@interface Function<__contravariant InType, __covariant OutType> : NSObject
{
// interestingly, this does work here (though OutType & InType are not available in the @implementation)
OutType (^_block)(InType);
}
@WeZZard
WeZZard / WWDC_2015_downloader.rb
Last active December 29, 2015 14:08
WWDC_2015_downloader.rb
require 'rubygems'
require 'mechanize'
if !((ARGV[0] == 'SD' || ARGV[0] == 'HD' || ARGV[0] == 'ALL') && ARGV.size == 1)
puts %q{Usage: ruby WWDC_2015_downloader.rb SD | HD | ALL}
puts %q{Example: ruby WWDC_2015_downloader.rb SD - to download all SD videos}
puts %q{Example: ruby WWDC_2015_downloader.rb HD - to download all HD videos}
puts %q{Example: ruby WWDC_2015_downloader.rb ALL - to download videos in all resolutions}
exit
end