Skip to content

Instantly share code, notes, and snippets.

Scott Rosenthal sr75

View GitHub Profile
@sr75
sr75 / yaml2json-python-bash-alias
Created Jun 10, 2019
yaml2json python bash alias one liner
View yaml2json-python-bash-alias
# https://medium.com/@frontman/how-to-parse-yaml-string-via-command-line-374567512303
alias yaml2json="python3 -c 'import sys,json,yaml;f=open(sys.argv[1]);d=yaml.safe_load(f);f.close();print(json.dumps(d))'"
# yaml2json ./vars.yml | jq ...
@sr75
sr75 / unstar.rb
Created Dec 30, 2015
unstar all the repos
View unstar.rb
# https://github.com/octokit/octokit.rb
require 'octokit'
Octokit.configure do |c|
c.login = ENV['GH_UID']
c.password = ENV['GH_PWD']
end
begin; Octokit.starred.each {|r| puts Octokit.client.unstar r.full_name}; end while Octokit.starred.size > 0;
@sr75
sr75 / osx-homebrew-setup.md
Last active Jun 18, 2020
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup
View osx-homebrew-setup.md

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

@sr75
sr75 / remove-python27-osx-via-pythonorg-installer-dmg.md
Last active Jun 5, 2020
remove python 2.7 on mac osx if installed via python.org installer .dmg
View remove-python27-osx-via-pythonorg-installer-dmg.md
# sudo rm -rf /Library/Frameworks/Python.framework
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
sudo rm -rf "/Applications/Python 2.7"
cd /usr/local/bin && \
sudo ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | xargs rm
@sr75
sr75 / launchd-conf-file-limits.md
Created Apr 25, 2014
increase file limits on OSX Mavericks for terminal error - too many open files
View launchd-conf-file-limits.md

If you run into terminal error too many open files

Below are the steps to increase the limit environment setting for maxflies

Show current config:

launchctl limit

maxfiles    256          unlimited
@sr75
sr75 / wget-jdk-oracle-install-example.txt
Last active Feb 1, 2020
wget command to install Oracle JAVA JDK from stupid oracle website for centos and ubuntu
View wget-jdk-oracle-install-example.txt
http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu
View DeployTo.ps1
param (
[string]$Deploy,
[switch]$SkipBackup,
[string]$Settings = "settings.xml"
)
$success = $false
function writeError($message) {
Write-Host $message -Foreground Red
break;
@sr75
sr75 / bash_profile
Last active Jun 8, 2018
Nice simple bash_profile & bashrc for rbenv/python/node/sublime/brew & bash completion terminal setup with colors on osx mavericks
View bash_profile
# rbenv & brew git/bash completion terminal setup
# for dev desktop only on osx
# Run the following commands in order to use this script:
################################################################
# !! => Update/Install xcode Command Line Tools <= !!
# In your shell/terminal:
# Homebrew perms needed:
# sudo chown -R root:admin /usr/local
# sudo chown -R root:admin /Library/Caches/Homebrew
# ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@sr75
sr75 / mysql-backup-restore-example.md
Created Sep 17, 2013
mysql backup and download to dev desktop for a local restore
View mysql-backup-restore-example.md

Say you ssh into a server as the user deployer and have a folder on the server ~/dump:

# on the server you are logged into
# backup the database
mysqldump -uroot -pstrongPassword railsapp_staging > ~/dump/YYYYMMDD_railsapp_staging.sql

# next logout/exit your ssh session to the server above
exit
You can’t perform that action at this time.