Skip to content

Instantly share code, notes, and snippets.

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

Waleed Ahmad waleedahmad

🏠
Working from home
View GitHub Profile
@waleedahmad
waleedahmad / react_es6_webpack.config.js
Created March 4, 2016 17:29
Webpack config file for React and ES6
var webpack = require('webpack');
module.exports = {
context: __dirname + "/src",
entry: "./app.js",
output: {
filename: "app.js",
path: __dirname + "/build",
},
@waleedahmad
waleedahmad / App.js
Last active November 24, 2020 23:52
Re-render Navbar component when children component is replaced on redirect
var App = React.createClass({
getInitialState(){
return {
auth : false
}
},
checkAuth(){
var self = this;
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
#!/bin/bash
USER="user"
PASSWORD="password"
OUTPUT="/home/backup_directory"
rm -rf "$OUTPUT"/*.gz > /dev/null 2>&1
databases=`mysql --user=$USER --password=$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework v5.2.9 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.2.8 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.2.7 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/framework v5.2.6 requires symfony/http-foundation 2.8.*|3.0.* -> satisfiable by symfony/http-foundation[2.8.x-dev, 3.0.x-dev] but these conflict with your requirements or minimum-stability.
- laravel/frame
@waleedahmad
waleedahmad / post_install.sh
Last active April 12, 2024 14:49
Ubuntu post installation script for installing software of your choice.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
@waleedahmad
waleedahmad / post_install_server.sh
Last active June 14, 2023 19:16
Ubuntu server post install bash script for installing software of your choice!
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
@waleedahmad
waleedahmad / dota_ping.sh
Last active June 2, 2024 20:28
DOTA Servers Ping Test
echo "DOTA Servers PING Test"
echo "----------------------"
echo "Region | Location | IP Address | Avg. ping"
s_ping=$(ping -c5 192.69.96.1 | tail -1| awk '{print $4}' | cut -d '/' -f 2)
echo "US WEST | Washington, USA | 192.69.96.1 | $s_ping"
s_ping=$(ping -c5 208.78.164.1 | tail -1| awk '{print $4}' | cut -d '/' -f 2)
echo "US EAST | Sterling, USA | 208.78.164.1 | $s_ping"
@waleedahmad
waleedahmad / downtime_db.py
Last active May 31, 2017 10:34
Python script to monitor your internet down time
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import socket, pymysql.cursors, time, sys
def internet(host="8.8.8.8", port=53, timeout=3):
try:
socket.setdefaulttimeout(timeout)
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host,port))
return True
@waleedahmad
waleedahmad / downtime.py
Last active June 13, 2024 02:38
Python script to monitor your internet down time
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import csv
import sys
import time
import socket
import datetime