Skip to content

Instantly share code, notes, and snippets.

View alexproca's full-sized avatar

Alex Proca alexproca

View GitHub Profile
@alexproca
alexproca / bashpath.sh
Created September 4, 2018 08:35 — forked from darrenderidder/bashpath.sh
Get path of running script in bash
#!/bin/bash
# A simple test script to demonstrate how to find the
# "absolute path" at which a script is running. Used
# to avoid some of the pitfals of using 'pwd' or hard-
# coded paths when running scripts from cron or another
# directory.
#
# Try it out:
# run the script from the current directory, then
@alexproca
alexproca / PPT.applescript
Created September 2, 2018 15:34 — forked from botanicus/PPT.applescript
Launch iTerm2 session with 3 split windows and run commands in them.
-- Find more at http://iterm.sourceforge.net/scripting.shtml
launch "iTerm"
tell application "iTerm"
activate
-- ssh in split panes to my varnish stack
set myterm to (make new terminal)
tell myterm

SSH Utils

A list of easy to memorize tools for using over ssh

Yes I know! configuration management for the win, infrastructure as code, docker, kubernetes but when you are there debugging in bash you will want to remember these:

Remote edit from VSCode

curl --range 0-500 -L bit.do/rmate

#initialize non-bare repo
git init; git config --local receive.denyCurrentBranch updateInstead
# add initial file
touch .non-bare
git add .
git commit -m 0
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/feedback">
<html>
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwPPVxEZgX5a7yItc14MCH4x4P6sJ8XA/6BRJoktCPrjWh0d5ypIoMwRWg/2PNQj3yoM+/jMyhJM5LzOuk28a31uVZGSbtfmKzr2v21FiiRJDQMC+SO1k7gzBAD1EHT/8CeiR8UFjiTdCIXalJStHpAxPdIk7nolx4jVSqBLZtStTtUupRzgPE82TGN4yc73iEexboYPhALLd0r2JjArvr3YpqyodvPFU9A0YYOEo1UiBH8R5Yhft8nja6rqu2NvbBT2C0TiCRBtTEUgaHvbG9diTXSxihJAIdf71ID8hHHKAjDzMBCT1dpvhWH2y7l0tLj4TccKsY2YKw19tVOO3V alex.proca@gmail.com
#fake http server
while true; do; echo "\n\n"; echo -e 'HTTP/1.1 200 OK\r\n' | sudo ncat -lv 80
#wire tap
ncat -lkv localhost 8080 -c 'tee /dev/stderr | ncat -v example.com 80 | tee /dev/stderr'
@alexproca
alexproca / docker-machine-rename
Last active November 23, 2020 17:15
Rename docker-machine
#!/usr/bin/env bash
#copy this in a folder from path ex: /usr/local/bin
#usage: docker-machine-rename default my-default
# Authors
#
# alexproca initial script
# eurythmia sed magic
database:
image: mongo
web:
image: myubuntu
ports:
- “8080:8080”
command: python -m SimpleHTTPServer
links:
database
@alexproca
alexproca / install-jira.sh
Last active November 9, 2015 23:00
Docker compose intall jira 7
#!/bin/bash
cd /tmp
apt-get install wget -y
wget https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-7.0.0-jira-7.0.0-x64.bin
chmod +x /tmp/atlassian-jira-software-7.0.0-jira-7.0.0-x64.bin
echo "executeLauncherAction$Boolean=true" > unattended
echo "app.install.service$Boolean=true" >> unattended
echo "sys.confirmedUpdateInstallationString=false" >> unattended
echo "existingInstallationDir=/usr/local/JIRA Software" >> unattended
echo "sys.languageId=en" >> unattended