Skip to content

Instantly share code, notes, and snippets.

View unaibamir's full-sized avatar

Unaib Amir unaibamir

View GitHub Profile
@ruledio
ruledio / app-size.py
Created January 4, 2019 11:28
Cloudways Disk Space Details/Quota Per Application
import subprocess
proc = subprocess.Popen("du -sh ./applications/* | sort -hr", shell=True, stdout=subprocess.PIPE)
for line in iter(proc.stdout.readline,''):
line = line.split()
size = line[0]
app_dir = line[1]
app_name = app_dir[15:]
app_conf = "/home/master/applications/%s/conf/server.apache" % (app_name)
@aaronbloomfield
aaronbloomfield / multiple-php-versions-on-ubuntu-16.04.md
Last active July 9, 2020 01:53
Running multiple PHP versions on Apache2 and Ubuntu 16.04

Setting up multiple apache2 instances on Ubuntu 16.04

PHP handling on apache is done via modules of one sort or another, and running multiple version is problematic on a single instance. The solution is to run two instances of apache on the same machine. This allows one instance to run PHP 7 (the default on 16.04), and another can run PHP 5. Since normal http/https is on ports 80 and 443, the second instance will run on ports 81 and 444. Since it is running on the same machine, all file system and database access is the exact same.

All the commands herein have to be run as root, or with sudo prefixed to the command.

  1. Read /usr/share/doc/apache2/README.multiple-instances

  2. Run sh ./setup-instance php5 from /usr/share/doc/apache2/examples, where php5 is the suffix for the second site; all commands for the second site will have that suffix. This will keep all of the same configuration for all sites on the new instance, including SSL certif

Found: master for fukuball/Awesome-Laravel-Education — A curated list of resources for learning about the Laravel PHP Framework — 25⭐️ — last updated today
🔎 Checking 269 links
⚪ http://laravel-taiwan.github.io/php-the-right-way/
⚪ https://github.com/laravel-taiwan/fig-standards/tree/master/accepted/zh-TW
⚪ https://www.facebook.com/groups/laravel.tw/
⚪ https://www.facebook.com/groups/849639948396465/
⚪ https://www.facebook.com/groups/laravel.tw/
⚪ https://www.facebook.com/groups/laravel.tw/
✅ https://raw.githubusercontent.com/fukuball/Awesome-Laravel-Education/master/laravel-logo-white.png
✅ http://laravel.com/docs/5.1/quickstart
@hissy
hissy / gist:7352933
Created November 7, 2013 11:07
[WordPress] Add file to media library programmatically
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
@asugai
asugai / Install composer on Amazon AMI running on EC2
Last active March 22, 2024 03:37
Install composer on Amazon AMI running on EC2
$ cd ~
$ sudo curl -sS https://getcomposer.org/installer | sudo php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo ln -s /usr/local/bin/composer /usr/bin/composer
then you can run
$ sudo composer install
@danasilver
danasilver / citystategeo.js
Created July 17, 2013 20:11
Get only city and state from Google Maps API Reverse Geocoder
if (window.navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
lng = position.coords.longitude,
latlng = new google.maps.LatLng(lat, lng),
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
for (var i = 0; i < results.length; i++) {
@chrisguitarguy
chrisguitarguy / comments-example.php
Created September 21, 2011 21:44
How to add custom fields to WordPress comments
<?php
/*
Plugin Name: Add Extra Comment Fields
Plugin URI: http://pmg.co/category/wordpress
Description: An example of how to add, save and edit extra comment fields in WordPress
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: MIT
*/