Skip to content

Instantly share code, notes, and snippets.

View desaiuditd's full-sized avatar
🚀

Udit Desai desaiuditd

🚀
View GitHub Profile
@desaiuditd
desaiuditd / hook.php
Created March 3, 2015 17:49
Git Webhook
<?php
// array - repo names and local filesystem path and branch
$repos = array(
'plugin-slug' => array (
'branch' => 'master',
'localpath' => '/var/www/example.com/htdocs/wp-content/plugins/plugin-slug'
),
);
hook_write_log( 'Hello at ' . date( 'D M j G:i:s T Y' ) );
@desaiuditd
desaiuditd / nginx-force-https
Last active August 29, 2015 14:16
Nginx Rules for Force HTTPS
#WWW to HTTPS+non-WWW
server {
server_name www.example.com ;
return 301 https://example.com$request_uri ;
}
#WWW to HTTPS+non-WWW
server {
listen 443 ;
server_name www.example.com ;
@desaiuditd
desaiuditd / gruntfile.js
Last active August 29, 2015 14:17
Grunt Deploy
// Generated on 2014-04-08 using generator-angular 0.8.0
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
@desaiuditd
desaiuditd / deploy.json
Last active December 3, 2020 16:29
Gulp rsync Deploy
{
"staging": {
"themeName": "example",
"destination": "/var/www/staging.example.com/htdocs/wp-content/themes/",
"root": "wp-content/themes/example",
"releasesDirectory": "/var/www/staging.example.com/releases/",
"hostname": "staging.example.com",
"username": "www-data",
"port": 22
},
{
"staging": {
"destination": "/var/www/staging.example.com/htdocs/",
"hostname": "staging.example.com",
"username": "www-data",
"port": 22,
"sshLocalPath": "/home/udit/.ssh/id_rsa"
},
"production": {
"destination": "/var/www/example.com/htdocs/",
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@desaiuditd
desaiuditd / get_meta.py
Last active August 29, 2015 14:21 — forked from jeffaudi/get_meta.py
This python script uses the Airbus Geo Catalog API to retrieve the meta-data associated to a list of imagery identifiers
# Script : get_meta.py
# Source : https://gist.github.com/jeffaudi/9fcac727cf6251287ecc/
# Copyright (c) 2014, Jeff Faudi
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@desaiuditd
desaiuditd / git-clone-non-empty-directory.md
Last active August 29, 2015 14:21 — forked from davisford/gist:5039064
git clone in non-empty directory

Let's say you start a project locally, and do some editing.

$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE

Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:

@desaiuditd
desaiuditd / wiki.md
Created August 3, 2015 13:40
Linode-EasyEngine

Easy Engine on Linode

Overall Installation of Easy Engine on Linode

Basic Linux Configurations for day to day operation

  1. Choose overall linode plan
  2. Configure Linode server based on EE Guidelines Ubuntu 64bit 14.04 LTS distro. Note: Make sure to configure swap based on guidlines link
  3. Login to Linode via SSH with root user.
  4. Setup www-data as day to day user.(document password and pass along to project lead)
  • www-data user already exists in the system. So we just need to enable its ssh login & set its password.
  • vim /etc/passwd
@desaiuditd
desaiuditd / SortLL_src_sortll_SortLL.java
Last active January 23, 2016 01:46
Sort Linked List
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sortll;
/**
*
* @author Pooja