Skip to content

Instantly share code, notes, and snippets.

View jamesstout's full-sized avatar

James Stout jamesstout

View GitHub Profile
@ttscoff
ttscoff / gauges.rb
Created April 11, 2013 20:41
OS X CLI for gaug.es stats
#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'net/https'
class KeyChain
def initialize(user=nil)
@user ||= %x{dscl . -read /Users/$(whoami)|grep "EMailAddress:"|sed 's/^EMailAddress: //'}
@host="com.brettterpstra.gauges"
@alexruperez
alexruperez / DDCLSLogger.h
Created August 22, 2016 18:04
Custom CocoaLumberjack logger which sends logs to Crashlytics.
@import CocoaLumberjack;
@interface DDCLSLogger : DDAbstractLogger
@end
@0x646e78
0x646e78 / Gitlab-Docker-certbot.md
Last active March 11, 2019 18:50
gitlab inside docker with certs from Let's Encrypt

Running gitlab inside docker with certs from Let's Encrypt

This will serve SSH and HTTPS (with which I got an A+ from testssl).

Creates three docker containers:

  • gitlab-prostgres
  • gitlab-redis
  • gitlab, which is linked to the other two. This contains nginx, sshd, git, gitlab.
@Sija
Sija / Benchmark.h
Created February 7, 2011 22:01
Objective-C benchmark utility class used in some of my projects
//
// Benchmark.h
// Opskrifter
//
// Created by Sijawusz Pur Rahnama on 03/02/09.
// Copyleft 2009. Some rights reserved.
//
#import <Foundation/Foundation.h>
@gnachman
gnachman / gist:4cbe6743baa7fe07536b
Last active April 16, 2022 23:42
Script to use Alfred with nightly build of iTerm2
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
@nicerobot
nicerobot / chrome-cookies.sh
Created December 7, 2011 16:59
Convert Google Chrome sqlite Cookies into cookies.txt. Useful for utilities like curl.
sqlite3 -separator ' ' ${COOKIES:-Cookies} \
'select host_key, "TRUE", path, "FALSE", expires_utc, name, value from cookies'
@lgw4
lgw4 / clean_open_with_menu.sh
Last active June 8, 2022 15:53
Remove duplicate application entries in Open With contextual menu.
#!/usr/bin/env sh
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user
echo "Open With contextual menu has been rebuilt; Finder will relaunch now."
killall Finder
@letiemble
letiemble / openssl-maker.sh
Last active April 23, 2023 11:33
A bash script to generate "all-in-one" OpenSSL static libraries for OS X and iOS. The script produces fat static libraries (i386, x86_64 for OS X) and (i386, x86_64, armv7, armv7s, arm64 for iOS) suitable for integration in both OS X and iOS project.
#!/bin/bash
###############################################################################
## ##
## Build and package OpenSSL static libraries for OSX/iOS ##
## ##
## This script is in the public domain. ##
## Creator : Laurent Etiemble ##
## ##
###############################################################################
@sveggiani
sveggiani / instructions.md
Last active July 15, 2023 21:52
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode #masscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project (Drupal) is served on /var/www/html in the Vagrant box
  • Local project files location: c:\Users\username\Work\projects\my-project\repo\html
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`