Skip to content

Instantly share code, notes, and snippets.

View arbal's full-sized avatar
👌
new Adaptor(this); // new Adaptor(_humans[].Behavior);

Arbal arbal

👌
new Adaptor(this); // new Adaptor(_humans[].Behavior);
  • Los Angeles, CA
  • 10:38 (UTC -07:00)
View GitHub Profile
@arbal
arbal / get_title_and_url.applescript
Created May 8, 2020 21:53 — forked from vitorgalvao/Get Title and URL.applescript
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Google Chrome
tell application "Google Chrome" to return title of active tab of front window
tell application "Google Chrome" to return URL of active tab of front window
-- Google Chrome Canary
@arbal
arbal / ask.sh
Created May 21, 2020 19:23
Bash General-Purpose Yes/No Prompt Function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# https://djm.me/ask
local prompt default reply
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"

progrium/bashstyle

Bash is the JavaScript of systems programming. Although in some cases it's better to use a systems language like C or Go, Bash is an ideal systems language for smaller POSIX-oriented or command line tasks. Here's three quick reasons why:

  • It's everywhere. Like JavaScript for the web, Bash is already there ready for systems programming.
  • It's neutral. Unlike Ruby, Python, JavaScript, or PHP, Bash offends equally across all communities. ;)
  • It's made to be glue. Write complex parts in C or Go (or whatever!), and glue them together with Bash.

This document is how I write Bash and how I'd like collaborators to write Bash with me in my open source projects. It's based on a lot of experience and time collecting best practices. Most of them come from these two articles, but here integrated, slightly modified, and focusing on the most bang for buck items. Plus some ne

@arbal
arbal / install.sh
Last active February 6, 2021 01:52 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@arbal
arbal / docker-compose.yml
Created June 24, 2020 18:38 — forked from gereltod/docker-compose.yml
example_docker_compose
version: '2'
services:
hello_world:
image: ubuntu
command: [/bin/echo, 'Hello world']
@arbal
arbal / install_ruby_rpi.sh
Created June 28, 2020 18:45 — forked from blacktm/install_ruby_rpi.sh
A Bash script to install Ruby 2.6 on the Raspberry Pi (Raspbian)
#!/bin/bash
# --------------------------------------------------------------------------------------------
# Installs Ruby 2.6 using rbenv/ruby-build on the Raspberry Pi (Raspbian)
#
# Run from the web:
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh)
# --------------------------------------------------------------------------------------------
# Welcome message
@arbal
arbal / osx_automount_nfs.md
Created July 9, 2020 17:47 — forked from L422Y/osx_automount_nfs.md
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

@arbal
arbal / gist:17056de3ab98d6d53c917f38ff267748
Created July 23, 2020 08:08 — forked from wrburgess/gist:3711050
Permanently remove file from Git history

Reference

Remove sensitive files from Git/Github

In Terminal

git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file path/name]' --prune-empty --tag-name-filter cat -- --all

Example:

@arbal
arbal / Proxomox - NUT Client.md
Created August 6, 2020 20:14 — forked from pae-id/Proxomox - NUT Client.md
Proxomox - NUT Client.md
@arbal
arbal / moveAmazonSavedItemsToWishList.js
Last active May 13, 2021 18:52 — forked from MichaelLawton/deleteAmazonSavedItems.js
Moves all Amazon saved for later items on the cart page to a private Wish List named "Saved For Later". It will only moves visible items. You might want to scroll first to make more items visible. To use paste code in developer console (Ctrl+Shift+J or Cmd+Opt+J in Chrome) then press enter.
function moveSavedItemsToWishList() {
var query = document.querySelectorAll("#sc-saved-cart input[value='Move to Wish List']")
if (query.length) {
query[0].click();
console.log("after move item click")
var wl = document.querySelectorAll("a[aria-label='Saved For Later (Private,item)']");
if (wl.length) {
wl[0].click();
}
console.log("after wishlist click")