Skip to content

Instantly share code, notes, and snippets.

View saxenap's full-sized avatar

Praveen Saxena saxenap

  • West Lafayette, IN
View GitHub Profile
@saxenap
saxenap / Makefile
Created April 19, 2018 18:34
Useful makefile functions
# get current directory
# works for Makefiles invoked from any directory:
# https://stackoverflow.com/a/18137056
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
# finds all files of extension (arg 2) in a directory (arg 1)
macro_find_files = $(shell find $(1) -type f -name "*.$(2)")
@saxenap
saxenap / PHP_Amazon_S3_File_Upload.php
Created April 17, 2018 18:44
PHP Amazon S3 File Upload Code AWS Signature Version 4
<?php
/**
* https://www.h3xed.com/programming/php-amazon-s3-file-upload-code-aws-signature-version-4
**/
// USER OPTIONS
// Replace these values with ones appropriate to you.
$accessKeyId = 'YOUR_ACCESS_KEY_ID';
$secretKey = 'YOUR_SECRET_KEY';
$bucket = 'YOUR_BUCKET_NAME';
$region = 'BUCKET_AMAZON_REGION'; // us-west-2, us-east-1, etc
@saxenap
saxenap / package.json
Created April 13, 2018 23:55 — forked from addyosmani/package.json
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
#!/bin/bash
# rm -rf mustache_php_ext && wget -O mustache_php_ext https://gist.githubusercontent.com/saxenap/52e417e591ed28da89ebdb2e8164050c/raw/ && chmod 777 mustache_php_ext && ./mustache_php_ext
yum install -y libtool
# install libmustache
git clone git://github.com/jbboehr/libmustache.git --recursive
cd libmustache
#!/bin/bash
# rm -rf inotify_install && wget -O inotify_install https://gist.githubusercontent.com/saxenap/f75497014d6e816f28d0520bf7d56ab7/raw/ && chmod 777 inotify_install && ./inotify_install
yum-config-manager --enable epel
yum update
yum install inotify-tools
yum-config-manager --disable epel
yum update
#!/bin/bash
# rm -rf allow_htaccess.sh && wget -O allow_htaccess.sh https://gist.githubusercontent.com/saxenap/0324c72fafa4a8d2b8111fa6020d25c5/raw/ && chmod 777 allow_htaccess.sh && ./allow_htaccess.sh
echo "<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>" > /etc/httpd/conf.d/allow_htaccess.conf
service httpd restart
#!/bin/bash
# rm -rf install_mysql57 && wget -O install_mysql57 https://gist.githubusercontent.com/saxenap/4636f60b69040ddded8cebeb242a6c41/raw/ && chmod 777 install_mysql57 && ./install_mysql57
yum install -y mysql57 mysql57-server
chkconfig mysqld on
service mysqld start
#!/bin/bash
# rm -rf innodb_memcached_sessions && wget -O gulp_install https://gist.githubusercontent.com/saxenap/4fcb3cbfc5c078166da1051837dcffe7/raw/ && chmod 777 innodb_memcached_sessions && ./innodb_memcached_sessions
extension=memcached.so
[memcached]
; Use session locking
; valid values: On, Off
; the default is On
memcached.sess_locking = Off
; Session spin lock retry wait time in microseconds.
; Be carefull when setting this value.
#either in MySQL directly:
mysql> source /usr/share/mysql57/innodb_memcached_config.sql;
#or in Shell:
mysql -e "source /usr/share/mysql57/innodb_memcached_config.sql;"
# When making changes to daemon_memcached plugin configuration, reload the plugin to apply the changes.