Skip to content

Instantly share code, notes, and snippets.

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

musaid musaid

🏠
Working from home
View GitHub Profile
@musaid
musaid / jed.cnf
Last active August 29, 2015 14:16 — forked from jedprentice/jed.cnf
[mysqld]
# Slow Log
#slow_query_log = 1
#log_queries_not_using_indexes = 1
#long_query_time = 1
# Disable DNS lookups for performance
skip_name_resolve
# MySQL >= 5.5.5 uses InnoDB by default, but set it just in case
<?php
class Encryption {
var $skey = "yourSecretKey"; // change this
public function safe_b64encode($string) {
$data = base64_encode($string);
$data = str_replace(array('+','/','='),array('-','_',''),$data);
return $data;
}
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName sample.local
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteCond %{HTTPS} !on
@musaid
musaid / delete.js
Last active August 29, 2015 14:04 — forked from irazasyed/laravel.js
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@musaid
musaid / doctrine-entity-serializer
Created July 7, 2014 19:08
Doctrine Entity Serializer for Doctrine ORM 2
<?php
/**
* Bgy Library
*
* LICENSE
*
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@musaid
musaid / classes.php
Created June 23, 2014 05:52
Rails-like PHP url router (by: Dan Sosedoff, originally posted at: http://blog.sosedoff.com/2009/09/20/rails-like-php-url-router/ )
<?php
define('ROUTER_DEFAULT_CONTROLLER', 'home');
define('ROUTER_DEFAULT_ACTION', 'index');
class Router {
public $request_uri;
public $routes;
public $controller, $controller_name;
public $action, $id;
Before compiling, install nginx-naxsi package. This package is compiled with the option --without-http_uwsgi_module.
Uninstall it but without purge for keeping configuration files.
Check https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source
---------- OLD ----------
543 wget https://dl.google.com/dl/page-speed/psol/1.6.29.5.tar.gz
->> https://github.com/pagespeed/ngx_pagespeed <<--
549 wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
553 wget http://nginx.org/download/nginx-1.5.8.tar.gz
#!/usr/bin/env python
# coding=UTF-8
import argparse
import math
import subprocess
import sys
def main(argv):
parser = argparse.ArgumentParser(description='Display current battery capacity')