Skip to content

Instantly share code, notes, and snippets.

Avatar
👽
working hard

Raphael Abreu aelkz

👽
working hard
View GitHub Profile
@aelkz
aelkz / sublime-text-macos-context-menu.md
Created May 4, 2022 — forked from idleberg/sublime-text-macos-context-menu.md
“Open in Sublime Text” in macOS context-menu
View sublime-text-macos-context-menu.md

This list has been updated for Big Sur (and later). Since I don't use these versions, this guide might still need further improvements. For older macOS versions, please see this older revision.

Open in Sublime Text

  • Open Automator
  • Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n "$@"
  • Set “Pass input” to as arguments
@aelkz
aelkz / backup.sh
Created Mar 11, 2021 — forked from mohitsethi/backup.sh
Backup and restore an Elastic search index (shamelessly copied from http://tech.superhappykittymeow.com/?p=296)
View backup.sh
#!/bin/bash
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
@aelkz
aelkz / setup-vmware-image-with-static-IP.markdown
Created Aug 19, 2020 — forked from pjkelly/setup-vmware-image-with-static-IP.markdown
VMWare Fusion Images with a static IP Address on Mac OS X Snow Leopard
View setup-vmware-image-with-static-IP.markdown

How to setup your VMWare Fusion images to use static IP addresses on Mac OS X

At Crush + Lovely, we use Railsmachine's Moonshine to automate the configuration of our servers. When writing our deployment recipes, VMWare Fusion's ability to take snapshots and rollback to these snapshots is a huge timesaver because it takes just seconds to roll a server image to it's original state.

When you're just configuring a single server, having a static IP address for your server image isn't too important, but when you're configuring multi-server setups, it can be useful to duplicate a number of server images and give each a static IP address so you can consistently deploy to them. While not documented well at all, it turns out that this is relatively easy to accomplish in four simple steps.

1. Determine the MAC address of your guest machine

Let's say you have a guest machine with the name ubuntu-lucid-lynx-base a

View maven-settings-template.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
@aelkz
aelkz / nexus3.sh
Created Apr 13, 2020
Nexus3 Openshift Configuration
View nexus3.sh
#!/bin/bash
#
# Configure Nexus3 after installation
#
# Call this script with parameters:
# $1: Nexus UserID
# $2: Nexus Password
# $3: Nexus URL
#
@aelkz
aelkz / x11_docker_mac.md
Created Apr 8, 2020 — forked from cschiewek/x11_docker_mac.md
X11 in docker on macOS
View x11_docker_mac.md

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@aelkz
aelkz / keycloak-client-deploy.sh
Created Feb 9, 2020
Red Hat Single Sign-On (Keycloak) - Client creation shell script
View keycloak-client-deploy.sh
#!/bin/bash
SSO_URL=localhost:8080
SSO_REALM=REDHAT
SSO_REALM_CERT=$SSO_REALM.pem
SSO_REALM_USERNAME=admin
SSO_REALM_PASSWORD=admin
SSO_API_CLIENT_ID=blueprint-sso-app
SSO_AUTH_URL=http://${SSO_URL}/auth
SSO_TOKEN_URL=http://${SSO_URL}/auth/realms/${SSO_REALM}/protocol/openid-connect/token
View curl-get-status-code-and-response-body.sh
URL="http://stackoverflow.com/"
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')