Skip to content

Instantly share code, notes, and snippets.

View ndrake's full-sized avatar
🐝

Nate Drake ndrake

🐝
View GitHub Profile
@amalmurali47
amalmurali47 / backup_digitalocean.md
Last active November 17, 2025 21:16
Backup DigitalOcean droplet locally

DigitalOcean does not provide a way to download a snapshot of your droplet locally. You can use rsync to accomplish this instead.

On your local machine, assuming you have added your-server in your SSH config:

rsync -aAXHv --append-verify --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} your-server:/
  • -a : archive mode (all files, with permissions, etc.)
  • -A : preserve ACLs/permissions (not included with -a)
@benjamincharity
benjamincharity / autonomous.txt
Last active November 5, 2025 21:48
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@paoloantinori
paoloantinori / keycloak.sh
Created January 26, 2016 15:59
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@remibantos
remibantos / wildfly_httpcache.md
Last active February 21, 2025 18:32
Wildfly 8 - HTTP cache headers tuning for rich client web application

Introduction

This Gist describes how to tune HTTP browser cache expiration for static contents served by Wildfly Undertow web server, as per RFC-2616 section 13.

Wildfly configuration

Description

In order to change HTTP browser cache behavior, a "Cache-Control" HTTP header has to be added to static content HTTP responses returned by Undertow.

Undertow subsystem configuration (standalone.xml)

@juanmirod
juanmirod / define.coffee
Created December 18, 2013 21:25
Hubot script for definitions using duckduckgo.com Instant answer API
# Description:
# Get a definition from duckduckgo.com api
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
@willurd
willurd / web-servers.md
Last active December 10, 2025 10:35
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@louismullie
louismullie / java-6-7-switch.sh
Created December 28, 2012 03:19
Switching Between Java 6 and Java 7 on Mac OS X
$ /usr/libexec/java_home -v '1.6*'
=> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
$ export JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
$ java -version
=> java version "1.6.0_37"
=> Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
=> Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
@grigs
grigs / browserdetect.js
Created March 13, 2012 17:12
Apple's Browser Detection Script - prettified from http://images.apple.com/global/scripts/browserdetect.js
if (typeof (AC) === "undefined") {
AC = {}
}
AC.Detector = {
getAgent: function () {
return navigator.userAgent.toLowerCase()
},
isMac: function (c) {
var d = c || this.getAgent();
return !!d.match(/mac/i)