Skip to content

Instantly share code, notes, and snippets.

@sr75
sr75 / yaml2json-python-bash-alias
Created June 10, 2019 20:28
yaml2json python bash alias one liner
# 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 December 30, 2015 04:17
unstar all the repos
# 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 June 18, 2020 06:35
Mac Yosemite OSX - Homebrew (RVM/MySQL/Redis) setup

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 June 5, 2020 02:37
remove python 2.7 on mac osx if installed via python.org installer .dmg
# 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 April 25, 2014 13:18
increase file limits on OSX Mavericks for terminal error - too many open files

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 March 16, 2023 11:28
wget command to install Oracle JAVA JDK from stupid oracle website for centos and ubuntu
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
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 June 8, 2018 03:34
Nice simple bash_profile & bashrc for rbenv/python/node/sublime/brew & bash completion terminal setup with colors on osx mavericks
# 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 / code-style-guides.md
Last active December 24, 2015 14:09
(Google/jQuery) HTML/CSS & JavaScript Code Style guides links:
@sr75
sr75 / mysql-backup-restore-example.md
Created September 17, 2013 13:09
mysql backup and download to dev desktop for a local restore

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