Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -euf -o pipefail
#### INSTRUCTIONS ########
# Before running this script:
# 1. Install the new Algolia CLI: https://www.algolia.com/doc/tools/cli/get-started/overview/
# 2. Install jq: https://stedolan.github.io/jq/download/
# 2. Add your application with `algolia profile add` and follow the prompts
# 3. Run `algolia profile list` and copy the name of the application you want to backup
# 4. Create an empty directory for this script and the files it will create
@keybits
keybits / gce-to-gcs-uploads.md
Created February 29, 2020 14:43 — forked from ryderdamen/gce-to-gcs-uploads.md
Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

I had a bit of trouble trying to configure permissions to upload files from my Google Compute Engine instance to my Google Cloud Storage bucket. The process isn't as intuitive as you think. There are a few permissions issues that need to be configured before this can happen. Here are the steps I took to get things working.

Let's say you want to upload yourfile.txt to a GCS bucket from your virtual machine. You can use the gsutil command line tool that comes installed on all GCE instances.

If you've never used the gcloud or gsutil command line tools on this machine before, you will need to initialize them with a service account.

@keybits
keybits / syncthing.sh
Created April 16, 2018 10:00 — forked from didenko/syncthing.sh
Enable Syncthing automatic startup on login in macOS
#!/bin/bash
#----------------------------------------------------
#
# Copyright (C) 2017 Vlad Didenko
#
# This Source Code Form is subject to the terms
# of the Mozilla Public License, v. 2.0. If a copy
# of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/
@keybits
keybits / agent.cmd
Last active August 29, 2015 14:16 — forked from Shoozza/agent.cmd
@ECHO OFF
REM Set default sock file
SET SSH_AUTH_SOCK=/tmp/ssh-agent.sock
REM Check socket is available
IF NOT EXIST "%TMP%\ssh-agent.sock" GOTO:RUNAGENT
REM Check if an ssh-agent is running
FOR /f "tokens=*" %%I IN ('ps ^| grep ssh-agent ^| sed "s/^ *\([0-9]\+\) .*/\1/"') DO SET VAR=%%I
### Keybase proof
I hereby claim:
* I am keybits on github.
* I am keybits (https://keybase.io/keybits) on keybase.
* I have a public key whose fingerprint is 9F7A E1B8 54B0 8C79 BE02 2E17 15E9 1238 93C6 C362
To claim this, I am signing this object:
"""
S3 Uploader for Python 3
Colton J. Provias
Usage:
f = open('sample.png', 'rb')
contents = f.read()
response, url = upload_to_s3('AWSKEY', 'AWSSECRET', 'mybucket', 'image.png', contents, 'image/png')
"""
@keybits
keybits / redirects.py
Created March 20, 2014 11:26
Testing redirects with Python 3 and requests
import requests
redirects = {
"http://github.com/": "https://github.com/",
"http://www.minktoast.net/": "http://minktoast.net/",
}
for key, value in redirects.items():
r = requests.get(key)
if r.url == value:
#!/bin/bash
# Favicon and Apple Touch Icon Generator
#
# This bash script takes an image as a parameter, and uses ImageMagick to convert it to several
# other formats used on modern websites. The following copies are generated:
#
# * apple-touch-icon-114x114-precomposed.png
# * apple-touch-icon-57x57-precomposed.png
# * apple-touch-icon-72x72-precomposed.png
@keybits
keybits / app.js
Created December 12, 2012 10:13
Just a test Gist
'use strict';
var converterApp = angular.module('converterApp', [])
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.otherwise({
@keybits
keybits / vim.md
Created October 30, 2012 20:47 — forked from stungeye/vim.md
Improving my VIM