Skip to content

Instantly share code, notes, and snippets.

@yosukehasumi
yosukehasumi / readme.md
Last active October 22, 2021 15:12
DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

  1. Setup
  2. Swapfile
  3. NGINX
  4. ElasticSearch
  5. RVM
  6. Rails
  7. Postgres
  8. Capistrano
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.oldurl', 'http://www.newurl');
@yosukehasumi
yosukehasumi / import-post-WP.php
Created December 13, 2016 17:44
Import a post into WP
<?php
// Run this file from terminal "php ./import-post-wp.php PATH-TO-JSON"
// Make sure you change permissions on the file so you can run it
echo "\n";
// use this to stop the script from actually saving anything
$debug = false;
// load WP to get all it's fancy functions
@yosukehasumi
yosukehasumi / insertParam.coffee
Created November 1, 2016 07:23
Modify URL paramaters using coffee
insertParam: (key, value) ->
key = encodeURI(key)
value = encodeURI(value)
url = document.location.search.substr(1).split('&')
for part, index in url by -1
param = part.split('=')
if param[0] == key
param[1] = value
url[index] = param.join('=')
@yosukehasumi
yosukehasumi / git-auto-deploy.md
Last active July 25, 2023 20:07
Setting Up Git-Auto-Deploy on Digital Ocean

Install software-properties-common

sudo apt-get install software-properties-common

Add Repo

sudo add-apt-repository ppa:olipo186/git-auto-deploy
@yosukehasumi
yosukehasumi / dbpull-drupal.rb
Created September 1, 2016 17:20
Pull database field relationships from Drupal
#!/usr/bin/env ruby
require 'mysql2'
require 'awesome_print'
require 'colorize'
db_name = 'db_name'
db_host = 'localhost'
db_username = 'db_user'
db_password = 'db_pass'
@yosukehasumi
yosukehasumi / dbsearch.rb
Last active August 31, 2016 06:02
Search for a string in all Columns and Tables (MYSQL)
#!/usr/bin/env ruby
# Use this script to search for a string in all columns and tables in MYSQL
# INSTALLATION
# gem install mysql2
# gem install awesome_print
# gem install colorize
# USAGE
# ./dbsearch.rb 'find me in db'
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@yosukehasumi
yosukehasumi / rare.sh
Last active July 13, 2017 17:29
Create a new wordpress boilerplate theme
#!/usr/bin/env bash
VERSION=2.0.12;
# Download this file, rename it to "rare", and place it in your bin directory (for mac it'll be something like usr/local/bin/rare).
# For OSX you could try this CURL command to install it:
# curl https://gist.githubusercontent.com/yosukehasumi/d0c905da78229122e7c1bb34a0fc92a7/raw/rare.sh > /usr/local/bin/rare;
# sudo chmod 755 /usr/local/bin/rare;
#
# To use this script, cd into your project directory and in command line type:
@yosukehasumi
yosukehasumi / Gruntfile.js
Last active August 29, 2015 14:15
Gruntfile.js
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-deployments');
grunt.initConfig({
deployments: {
options: {
backups_dir: './backups'
},
local: {
"title": "Local",