Skip to content

Instantly share code, notes, and snippets.

View Ammly's full-sized avatar
🏠
Working from home

Ammly Ammly

🏠
Working from home
View GitHub Profile
#!/bin/bash
## The post install script for Ubuntu 14.04 LTS
## @author Carlo Micieli
## @version 5.0.5
## Constants
NONE='\e[39m'
RED='\e[31m'
GREEN='\e[32m'
CYAN='\e[36m'
@Ammly
Ammly / gist:e8123cfb7d5bbed13917
Created November 5, 2015 14:42 — forked from noeldiaz/gist:0f9a2583a41579878764
Homestead 32-bit Version
## Making a 32 bit version of Homestead
# Clone the settler repository to a directory
git clone https://github.com/laravel/settler.git Ubuntu32
# In that directory edit the file called "Vagrantfile" to use a ubuntu 32 box instead of the 64 bit one
change this line:
config.vm.box = "ubuntu/trusty64"
@Ammly
Ammly / index.php
Created June 14, 2016 14:57
Reload list items every 30 seconds. The php functions are getting the users from mysql db (working correctly)
<?php
<div class="usr_content">
<ul>
// list item to reload
<li class="disabled success" id="reload">Online Users
<?php
$onlineUsers = $demo->getOnlineUsers($current_user, $user_company);
foreach ($onlineUsers as $key => $onlineUser) {
if (is_array($onlineUser)){
@Ammly
Ammly / enter_key_to_send.html
Last active June 16, 2016 06:17
Press enter key to submit form
<form>
<textarea></textarea>
<input type="submit" value="Submit"/>
</form>
<script>
$("textarea").keyup(function(event){
if(event.keyCode == 13){
$("form").submit();
}
@Ammly
Ammly / file_upload.html
Created June 17, 2016 06:41
Upload file using jquery file upload lib. autosubmit:false
<html>
<head>
<link href="https://rawgithub.com/hayageek/jquery-upload-file/master/css/uploadfile.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://rawgithub.com/hayageek/jquery-upload-file/master/js/jquery.uploadfile.min.js"></script>
</head>
<body>
<div class="container">
<form action="" class="form">
<textarea class="form-contol" contenteditable data-emojiable="true" placeholder="Type a message here"
{
"additional_path_items":
[
"/usr/local/php5/bin/"
],
"auto_complete_selector": "source, text",
"bold_folder_labels": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"font_face": "Fira Code",
"font_options":
@Ammly
Ammly / task01.py
Created July 24, 2017 15:01
Tech Academy python 101
# 100th birthday
def task1():
name = str(input("Enter your name: "))
age = int(input("Enter your age: "))
yearsToHundred = (100 - age) + 2017
@Ammly
Ammly / test1.php
Last active September 18, 2017 09:19
Php tests
<?php
/*
Challenge #1:
Write an algorithm that takes an array and moves all of the zeros to the end, preserving the order of the other elements.
moveZeros([false, 1, 0, 1, 2, 0, 1, 3, "a"])
// returns [false, 1, 1, 2, 1, 3, "a", 0, 0]
@Ammly
Ammly / gulpfile.js
Created July 27, 2016 08:24
Gulp file to optimize js,css and images
npm install gulp-concat gulp-uglify gulp-strip-debug gulp-autoprefixer gulp-minify-css gulp-changed gulp-imagemin gulp-jshint --save-dev
// include gulp
var gulp = require('gulp');
//jshint
var jshint = require('gulp-jshint');
var changed = require('gulp-changed');
//imgs
var imagemin = require('gulp-imagemin');
var minifyHTML = require('gulp-minify-html');
@Ammly
Ammly / gist:ff4f5ad2ce7080ef9a7ceeb9d499936e
Created February 13, 2019 16:37 — forked from kyledrake/gist:d7457a46a03d7408da31
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt