Skip to content

Instantly share code, notes, and snippets.

@tonysneed
tonysneed / Mac OS X: Open in Visual Studio Code
Last active March 27, 2024 10:02
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
@rgaidot
rgaidot / docker-resources.md
Last active October 22, 2023 13:02
Docker Resources All In One - A collection of docker online resources
haproxy.conf
============
frontend spdy
mode tcp
bind xxx.xxx.xxx.xxx:443 ssl crt /etc/haproxy/ssl.pem crt /etc/haproxy/certs.d npn spdy/3.1,http/1.1 ciphers AES256+EECDH:AES256+EDH:AES128+EDH:EECDH:!aNULL:!eNULL:!LOW:!DES:!3DES:!RC4; no-sslv3
option tcplog
log global
# route to nginx
@erans
erans / mongobackup.sh
Last active October 7, 2019 16:59
MongoDB ReplicaSet Backup Script on Google Compute Engine and Google Cloud Storage
# Path to boto config file, needed by gsutils
BOTO_CONFIG="/etc/boto.cfg"
# Path in which to create the backup (will get cleaned later)
BACKUP_PATH="/mnt/data/dump/"
# DB name
DB_NAME="mydatabase"
# Google Cloud Storage Bucket Name
@xoppa
xoppa / fragment.glsl
Last active November 9, 2023 21:52
Fragment lighting shader
#ifdef GL_ES
#define LOWP lowp
#define MED mediump
#define HIGH highp
precision mediump float;
#else
#define MED
#define LOWP
#define HIGH
#endif
#!/bin/bash
BASE_DIR=${TMPDIR:-/var/tmp}
ORIG_DIR=$PWD
HASH_CMD="md5sum"
DIR_NAME=`echo $PWD | $HASH_CMD | cut -f1 -d " "`
TMP_DIR=$BASE_DIR/$DIR_NAME
mkdir -p $TMP_DIR
@ib-lundgren
ib-lundgren / gmail.py
Created September 25, 2013 13:25
How to fetch emails from GMail using an OAuth 2 Bearer token and GMails SASL XOAuth2 mechanism.
"""Fetching the latest GMail email using OAuth 2 and IMAP.
Requires requests-oauthlib, which is available on pypi.
Includes a basic SASL XOAUTH2 authentication method for imaplib.
"""
# Credentials you get from registering a new web application in Google API Console
client_id = 'your-id.apps.googleusercontent.com'
client_secret = 'your secret'
redirect_uri = 'your callback uri'