Skip to content

Instantly share code, notes, and snippets.

@saggie
saggie / installing_localstack_on_mac.md
Last active June 1, 2019 06:41
Installing localstack on Mac

Installing localstack on Mac

Installing Java 8

Java 8 is required.

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
@saggie
saggie / generate.sh
Last active May 27, 2019 03:42
Generating & deploying code by Swagger Codegen CLI
#!/bin/bash
#
# Usage: ./generate.sh <Maven repository URL>
# - e.g. ./generate.sh https://artifactory.example.com/artifactory/maven
#
# Pre-req: wget, java
#
set -eu
if [ $# -ne 1 ]
@saggie
saggie / installing_node_js_on_mac_by_nodebrew.md
Created May 25, 2019 07:29
Installing Node.js on Mac by nodebrew
brew install nodebrew
/usr/local/opt/nodebrew/bin/nodebrew setup_dirs
echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
nodebrew setup
nodebrew -help
nodebrew ls-all
nodebrew install-binary v10.15.3
nodebrew use v10.15.3
@saggie
saggie / poll_until_service_is_ready.py
Created April 25, 2019 08:17
Polling until service is ready in Python 3
def try_login():
try:
response = requests.post(SESSIONS_URI, auth=('username', 'password'), json={})
return response.headers['...']
except:
print('The service is not started yet.')
return False
def try_get_resources(token):
try:
@saggie
saggie / Opting out of Homebrew's analytics.md
Last active March 31, 2019 00:51
Opting out of Homebrew's analytics
$ brew analytics  # to see the current status
Analytics is enabled.
UUID: ...
$ brew analytics off
$ brew analytics  # to confirm
Analytics is disabled.
@saggie
saggie / How to mirror a Git repository.md
Last active March 31, 2019 00:52
How to mirror a Git repository
# After creating an empty repository at destination site...
git clone --mirror http://__SOURCE_SITE__/path/to/repository.git
cd repository.git/
git remote add mirror1 http://__DESTINATION_SITE__/path/to/repository.git
git push mirror1 --mirror
@saggie
saggie / Download a canvas image.js
Last active January 3, 2019 06:25
Download a canvas image
const dummyLink = document.createElement("a");
dummyLink.download = "image_file_name.png"
const canvas = document.getElementById("canvas");
canvas.toBlob(function (blob) {
dummyLink.href = window.URL.createObjectURL(blob);
document.body.appendChild(dummyLink);
dummyLink.click();
document.body.removeChild(dummyLink);
@charset "utf-8";
h1,h2,h3,h4,h5,h6 {
a {
text-decoration: none;
}
}
a:link {
color:#474A54;
}
@saggie
saggie / .bashrc
Created October 31, 2018 04:11
Setup Ubuntu
# --- MINE ---
# Proxy
export http_proxy='http://xx.xx.xx.xx:3128'
export https_proxy=$http_proxy
export no_proxy='localhost,.foo.bar.com'
# Java
JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
export JAVA_HOME
@saggie
saggie / Installing Mate + XRDP for Ubuntu 18.md
Created May 30, 2018 03:24
Installing Mate + XRDP for Ubuntu 18
  1. sudo apt-get install -y ubuntu-mate-desktop
    • Select "gdm3" if a dialog pops up
  2. sudo reboot
  3. sudo apt-get install -y xrdp
  4. echo 'unset DBUS_SESSION_BUS_ADDRESS' >> ~/.xsession
  5. echo 'mate-session' >> ~/.xsession
  6. sudo gedit /etc/X11/Xwrapper.config
    • Change allowed_users from console to anybody
  7. sudo reboot