Skip to content

Instantly share code, notes, and snippets.

View jamesdube's full-sized avatar
🛰️
To the moon

James Dube jamesdube

🛰️
To the moon
View GitHub Profile
# This script is for automating the www folder permissions for development setup on your web server
chown -R eve contoso.com
chgrp -R www-data contoso.com
chmod -R 750 contoso.com
chmod g+s contoso.com
@jamesdube
jamesdube / createhost
Last active May 12, 2020 12:34
Automatically create Virtual Host in apache
#!/bin/bash
echo "Enter the VirtualHost name : "
read name
echo "Enter the VirtualHost root [/var/www/html/] : "
read root
if [ -d "/var/www/html/"$root ]
then
if [ -w /etc/hosts ]
echo "creating apache virtial host..."
@jamesdube
jamesdube / CreateArrayRequest.php
Created November 27, 2015 07:33
Validate array input laravel
<?php namespace App\Http\Requests;
use App\Http\Requests\Request;
class OrderRequest extends Request {
/**
* Determine if the user is authorized to make this request.
*
* @return bool
@jamesdube
jamesdube / Helpers.php
Created July 21, 2016 14:52
Convert a Assoc Array to an Indexed One
static function assocToIndexed(array $assocArray)
{
$numeric = array();
foreach ($assocArray as $item=>$value){
$numeric[] = $value;
}
return $numeric;
}
@jamesdube
jamesdube / 0_reuse_code.js
Created October 27, 2016 15:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jamesdube
jamesdube / .htaccess
Created December 16, 2016 13:43
Remove public from a Laravel application url
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
@jamesdube
jamesdube / Linux Static IP
Created March 27, 2017 10:50 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
<?php
echo "hello world";
@jamesdube
jamesdube / create_adsi_linked_server.sql
Created January 5, 2018 05:55
Query Active Directory Users From SQL Server via ADSI Linked Server
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver @server = N'ADSI', @srvproduct=N'Active Directory Service Interfaces', @provider=N'ADSDSOObject', @datasrc=N'adsdatasource'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'ADSI',@useself=N'False',@locallogin=NULL,@rmtuser=N'domain\user_acc',@rmtpassword='someawesomepassword'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'collation compatible', @optvalue=N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'data access', @optvalue=N'true'
GO
EXEC master.dbo.sp_serveroption @server=N'ADSI', @optname=N'dist', @optvalue=N'false'
@jamesdube
jamesdube / gist:155345a79b9fef0d972999862d8f3791
Created June 6, 2018 18:10 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote