Skip to content

Instantly share code, notes, and snippets.

@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
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 / 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
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'uri'
require 'net/http'
require 'rainbow'
require 'awesome_print'
class Crawl
@yosukehasumi
yosukehasumi / Commands
Created August 22, 2017 17:18
Creating a Rails Applications - Full Stack
rails new ProjectName -d mysql
@yosukehasumi
yosukehasumi / propone-server.md
Created November 28, 2017 18:32
Setting up Propeller One Digital Ocean droplet
@yosukehasumi
yosukehasumi / .bash_profile
Last active November 24, 2022 03:41
my_bash
#!/usr/bin/env bash
export CLICOLOR=1
export TERM=xterm-256color
export BASH_SILENCE_DEPRECATION_WARNING=1
# PS1
export PS1="________________________________________________________________________________\n| \w \n| => "
export PS2="| => "
# Set default editor
@yosukehasumi
yosukehasumi / proxy.rb
Created August 22, 2018 18:01
Digital Ocean Proxy server generation for ngrok
#!/usr/bin/env ruby
require 'awesome_print'
require 'json'
PROXY_NAME = 'proxy'
ACCESS_TOKEN = 'XXXXXXXX'
# DESTROY
def destroy_all_servers
@yosukehasumi
yosukehasumi / setup.md
Last active May 4, 2022 16:54
My OSX setup from clean install
  • Enabled Tap to Click
  • Enable Trackpad Dragging (found in accessibility settings)
  • Add my .bash_profile https://gist.github.com/yosukehasumi/fb5c97f661ee3d4e1b41049707606fb5
  • Add item word jump hotkeys for iTerm (Preferences > Profiles > Keys > Presets: 'Natural Text Editing')
  • Hide Dock (defaults write com.apple.Dock autohide-delay -float 5 && killall Dock)
  • Hide icons on Desktop (defaults write com.apple.finder CreateDesktop false; killall Finder;)
  • Generate SSH keys `ssh-keygen -t rsa -b 4096 -C "your@email.com"

Install

  • Chrome
@yosukehasumi
yosukehasumi / assignment.markdown
Last active February 5, 2019 03:36
img240 Week 4 Assignment

Assignment 4

This week we'll be creating a "Personal Finance" web app, where you can keep track of your budget and spending

The app will just have one controller that will list your spending and budget. It will allow you to add, modify and delete spending from the database.

Setup

Git setup