Skip to content

Instantly share code, notes, and snippets.

View Nakira's full-sized avatar

Jean-Charles van der Bruggen Nakira

View GitHub Profile
@pacoorozco
pacoorozco / wp-update.sh
Last active July 7, 2024 20:04
Backup and update a Wordpress Site using wp-cli
#!/usr/bin/env bash
##########################################################################
# Shellscript: Backup and update WordPress using wp-cli
# Author : Paco Orozco <paco@pacoorozco.info>
# Requires : wp-cli
##########################################################################
# Changelog
# 20170125: 1.0
# Adds a default option to upgrade only when it's needed.
# 20161220: 0.1
@Lego2012
Lego2012 / htaccess-yo-jekyll
Last active March 11, 2021 00:46
htaccess - You Jekyll Generator #htaccess #jekyll
# Apache Configuration File
# (!) Using `.htaccess` files slows down Apache, therefore, if you have access
# to the main server config file (usually called `httpd.conf`), you should add
# this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html.
# ##############################################################################
# # CROSS-ORIGIN RESOURCE SHARING (CORS) #
# ##############################################################################
@syafiqfaiz
syafiqfaiz / how-to-copy-aws-rds-to-local.md
Last active June 22, 2024 20:31
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@harryfinn
harryfinn / wp-cli-migrate-db.md
Created March 24, 2016 11:59
WP-CLI DB migrate instructions

Instructions for using WP-CLI to migrate a WordPress DB

# Export current (local) DB
wp db export db.sql

# Copy file from local to server (may need to amend server path if not in html folder)
# The example below is for local to remote, simply swap these 2 around for remote to local
scp -r db.sql www-data@IP_ADDRESS:/var/www/html

# SSH onto box (should be same connection details as above)
@phindmarsh
phindmarsh / FacebookGrant.php
Last active July 2, 2016 16:20
Facebook Grant Type
<?php
namespace MyApp\OAuth2\GrantType;
use Facebook\FacebookRequest;
use Facebook\FacebookSession;
use Facebook\GraphUser;
use OAuth2\RequestInterface;
use OAuth2\ResponseInterface;
use OAuth2\Storage\ClientCredentialsInterface;
use OAuth2\Storage\AccessTokenInterface;
@attilahorvath
attilahorvath / dump_restore_mysql_utf8mb4.sh
Created March 13, 2015 13:33
Dump/restore MySQL database with utf8mb4 encoding
# dump
mysqldump -u user -p database --default-character-set=utf8mb4 --result-file=dump.sql
# restore
mysql -u user -p database < dump.sql
@vasildakov-zz
vasildakov-zz / Module.php
Last active November 21, 2021 05:32
ZF2 and Doctrine Entity listeners resolver
<?php
namespace Application;
class Module
{
public function onBootstrap(MvcEvent $e)
{
$application = $e->getTarget();
$serviceManager = $application->getServiceManager();
$sharedManager = $application->getEventManager()->getSharedManager();
@shime
shime / _readme.md
Last active April 28, 2023 18:56
github oauth in node using express

What?

Most basic example of authenticating with Github in node.

How?

Clone this gist, change keys inside config.js and then hit npm install && node app.js.

Done?

@niksumeiko
niksumeiko / git.migrate
Last active August 27, 2024 08:20
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@aquelito
aquelito / git-command.md
Last active September 19, 2024 13:52
GIT - Ligne de commande principale
title category
Git config
Git

Rappel

Ne pas oublier : l'aide en ligne de commande.