Skip to content

Instantly share code, notes, and snippets.

for host in $SSH_HOSTS; do
ssh $host 'sudo apt update ; sudo apt-cache policy openssh-server ; sudo apt install openssh-server'
done

Code. Is. EVERYWHERE.

Laptops | Tablets | Phones | Robots | Watches | Cars | Thermostats | Biometrics | Televisions | Light Bulbs | Door Locks | Fridge | Grill | Toasters | Credit Cards | Jewelry | And More...

What makes up the Web?

Linux | FOSS | HTML | CSS | Javascript | jQuery | Angular | Java | Scala | Go | Python | Django | PHP | WordPress | Magento | Ruby | Rails | Sinatra | MySQL | PostgreSQL | Apache Ngninx | Github | Facebook | Tumblr | YouTube | RaspberryPi | Arduino | C.H.I.P.

@fstrube
fstrube / magento-cp
Last active December 20, 2015 12:49
BETA: A shell script for copying a Magento instance on the same server. Useful for quickly spinning up a new staging environment on a shared host.
#!/bin/sh
#/ Usage: magento-cp [options] <source> <destination>
#/
#/ Options
#/ --no-anon WARNING: do not anonymize customer data
#/ --db-host=<host|socket> the new database info
#/ --db-name=<name>
#/ --db-user=<user>
#/ --db-password=<password>
#/ --exclude=<pattern> exclude specific directories during copy (can occur multiple)
@fstrube
fstrube / cron-now.py
Last active December 11, 2015 06:19
This simple script will list all of your entries in your crontab file, and allow you to choose which one to run immediately.
#!/usr/bin/env python
from subprocess import call, Popen, PIPE
import re
def main():
"""
Prompts the user which cronjob they would like to run, then
runs it in the shell.
@fstrube
fstrube / nginx-magento
Last active March 17, 2021 10:52
nginx-magento
server {
listen 80;
root /var/www/magento;
index index.php index.html index.htm;
server_name magento.local;
# Place PHP error logs in the Magento log folder
@fstrube
fstrube / basecamp-todos.js
Created July 15, 2012 19:52
Bookmarklet to make Basecamp todo's better (parse priority and progress, similar to todo.txt)
;(function(){
var todos = $$('.item .content span .content span:first-child');
todos.each(function(element) {
if ( element.getAttribute('data-original-text') ) element.innerText = element.getAttribute('data-original-text');
parseTodo(element);
});
function parseTodo(element) {
/* Original Text */
@fstrube
fstrube / svn-to-git.sh
Created June 7, 2012 22:26
Convert Subversion repositories to Git
#!/bin/sh
## -- Usage -- ##
#
# svn-to-git <svn_repository_url>
#
# svn_repository_url e.g. svn+ssh://svn.example.com/projects/hello_world
#
SVN=$1
@fstrube
fstrube / Rakefile
Created June 5, 2012 14:17
Rake tasks for deploying a web app via rsync, and comparing local / remote file changes
# Include all rake files in the tasks directory
Dir.glob('tasks/*.rake').each { |r| import r }
# Read configuration from tasks/config.yaml
require 'yaml'
CONFIG = YAML.load_file('tasks/config.yaml')[ENV['env'] || 'development']
# Default utility functions available in all tasks
def ok_failed(condition)
if (condition)
@fstrube
fstrube / Rakefile
Created June 1, 2012 22:17
Rake tasks for a Magento extension using modman
require 'rake'
desc 'Displays current version'
task :version do
puts "Current version is #{Version.new.to_s}"
end
namespace :version do
desc "Bump version number"
task :bump do
@fstrube
fstrube / .bashrc
Created June 1, 2012 18:25
Place your git branch name and status in your Bash / Terminal prompt
# Adding git-specific info to prompt
update_git_cwd() {
if git status > /dev/null 2>&1 && local BRANCH=`git branch | grep '^*' | cut -c3-`; then
if ! git status 2>/dev/null | grep 'working directory clean' > /dev/null 2>&1 ; then
BRANCH="$BRANCH\033[31m*"
fi
PS1=`printf '[local:\W (\033[32m%s\033[0m)] \$ ' "$BRANCH"`
else
PS1='[local:\W ] \$ '
fi