Skip to content

Instantly share code, notes, and snippets.

View dharma017's full-sized avatar

Dharma R. Thapa dharma017

  • Melbourne, Australia
View GitHub Profile
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /usr/local/etc/nginx/ssl/{{host}}.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/{{host}}.key;
ssl_ciphers HIGH:!aNULL:!MD5;
# listen 80;
server_name {{host}};
@dharma017
dharma017 / save-all-images.sh
Created January 20, 2017 05:16 — forked from lalyos/save-all-images.sh
script to save all docker image, and load them back
reload() {
source ${BASH_SOURCE[0]}
}
alias r=reload
get-image-field() {
local imageId=$1
local field=$2
: ${imageId:? reuired}
hub:
image: selenium/hub
ports:
- "4444:4444"
container_name: hub
node:
image: selenium/node-firefox
links:
- hub
environment:
@dharma017
dharma017 / README-Template.md
Created January 5, 2017 06:19 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@dharma017
dharma017 / sync-prod.sh
Created December 30, 2016 04:42 — forked from retlehs/sync-prod.sh
WP-CLI aliases sync example
read -r -p "Would you really like to reset your development database and pull the latest from production? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
wp @development db reset --yes
wp @production db export - > sql-dump-production.sql
wp @development db import sql-dump-production.sql
wp @development search-replace https://example.com https://example.dev
else
exit 0
fi
@dharma017
dharma017 / menu.twig
Created December 12, 2016 07:06 — forked from peksi/menu.twig
Bootstrap dropdown navbar implementation for Wordpress Timber plugin.
{# Bootstrap dropdown navbar for Wordpress #}
<ul class="nav navbar-nav">
{% for item in menu %}
{% if (item.get_children) %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{item.title}} <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for subitem in item.get_children %}
@dharma017
dharma017 / vhost.py
Created November 4, 2016 09:08 — forked from fideloper/vhost.py
Create vHost Ubuntu Lamp-Server (bash and python)
#! /usr/bin/python
from sys import argv
from os.path import exists
from os import makedirs
from os import symlink
from os import system
import getopt
#
@dharma017
dharma017 / DB.sql
Created August 14, 2016 11:03 — forked from msurguy/DB.sql
Dynamic dropdown in Laravel, let's say you have multiple drop downs (selects), you click on one and the contents of the other need to be dynamically changed. One solution is to dynamically load JSON from the API and change the dropdown dynamically depending on the user choice.
CREATE TABLE `makers` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`description` varchar(255) NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
@dharma017
dharma017 / Gulpfile.js
Created August 2, 2016 08:57 — forked from 0x1ad2/Gulpfile.js
My gulpfile example for How to enhance your front-end development workflow using Gulp
/*
* 0x1ad2 base Gulp.js file
* https://twitter.com/0x1ad2
*/
/*
* Define plugins
*/
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
@dharma017
dharma017 / phalconphp_php7_ubuntu_16_04.sh
Created July 26, 2016 07:08 — forked from Tosyn/phalconphp_php7_ubuntu_16_04.sh
PhalconPhp with PHP7 Installation on Ubuntu 16.04
#!/bin/bash
# PhalconPhp with PHP7 installation on ubuntu:16.04
sudo apt-get update
sudo apt-get install -y php7.0-fpm \
php7.0-cli \
php7.0-curl \
php7.0-gd \