Skip to content

Instantly share code, notes, and snippets.

View elchappo's full-sized avatar
👻

Pawel Zareba elchappo

👻
View GitHub Profile
@elchappo
elchappo / wordpress-change-domain-migration.sql
Created December 7, 2017 01:25 — forked from chuckreynolds/wordpress-change-domain-migration.sql
Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. __STEP3: make sure your databa…
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
#UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);
@elchappo
elchappo / Mac OS X: Open in Visual Studio Code
Created December 1, 2017 00:33 — forked from tonysneed/Mac OS X: Open in Visual Studio Code
Add a command to Finder services in Mac OSX to open a folder in VS Code
- Open Automator
- File -> New -> Service
- Change "Service Receives" to "files or folders" in "Finder"
- Add a "Run Shell Script" action
- Change "Pass input" to "as arguments"
- Paste the following in the shell script box: open -n -b "com.microsoft.VSCode" --args "$*"
- Save it as something like "Open in Visual Studio Code"
version: '3'
services:
###############################
# Built from local Dockerfile #
###############################
web:
# Build the Dockerfile in this directory.
build: .
# Mount this directory as a volume at /app
volumes:
@elchappo
elchappo / dbal-nullable.php
Created May 2, 2016 17:56 — forked from chrisguitarguy/dbal-nullable.php
Just in case anyone was wondering how set allow a column to be nullable with Doctrine DBAL's Schema later.
<?php
use Doctrine\DBAL\Schema\Schema;
// assuming you're using composer...
$loader = require __DIR__ . '/vendor/autoload.php';
$schema = new Schema();
$users = $schema->createTable('users');
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
@elchappo
elchappo / gist:6114482
Created July 30, 2013 16:23
BASH: Find unique images by file name
find . -name '*.png' -exec basename {} \; | sort | uniq -u | wc -l
@elchappo
elchappo / boc.py
Created April 30, 2013 14:06 — forked from mekza/boc.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
import itertools
import requests
import json
characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
password_length = 6
gen = itertools.combinations_with_replacement(characters,password_length)
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder