Skip to content

Instantly share code, notes, and snippets.

@lamguy
lamguy / nginx.conf
Created June 22, 2018 14:59 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@lamguy
lamguy / athena_cheatsheet.md
Created May 17, 2018 16:14 — forked from steveodom/athena_cheatsheet.md
AWS Athena / Hive / Presto Cheatsheet

Useful Links / Sources

Housekeeping

change column type

ALTER TABLE logs.trades CHANGE recentprice price int;
@lamguy
lamguy / default
Created January 18, 2018 13:59 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@lamguy
lamguy / RequestGSMA.php
Created October 26, 2017 18:28
Request GSMA
<?php
$imei = "354408064463695";
$apiKey = 'C31xxx950';
$password = 'paxxx#d';
$salt = 'Dxxx';
$orgID = 187;
$secret = 'GSxxxion';
$signatureHash = hash("sh256", $apiKey . $password . $imei);
@lamguy
lamguy / gsma.php
Last active September 1, 2017 18:29
<?php
$url = 'https://devicecheck.gsma.com/imeirtl/detailedblwithmodelinfo';
//INITIATE cURL
$ch = curl_init($url);
//CREATE PAYLOAD
$payload = array(
@lamguy
lamguy / nginx.conf
Created August 25, 2017 14:53 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@lamguy
lamguy / pivot.sql
Created February 10, 2016 16:46
MySQL Rows to Columns
-- http://stratosprovatopoulos.com/web-development/mysql/mysql-dynamically-convert-rows-to-columns/
SET group_concat_max_len=20000;
SET @a = 0;
SET @b = 0;
set @num := 0;
SET @regno := '';
SET @line1 = CONCAT (
@lamguy
lamguy / PHPExcel_Basics.md
Created October 29, 2015 16:30 — forked from r-sal/PHPExcel_Basics.md
PHPExcel Notes and code snippets

Basics

Creating a new PHPExcel Object.

    $this->PHPExcel = new PHPExcel();

Working with sheets

Creating a new sheet:

@lamguy
lamguy / array_rotating.php
Created September 29, 2015 15:14
PHP rotating in array
<?php
function rotate($object, $object_uid, $property, $array, $field_index='uid', $return_field = "name")
{
global $db;
$return_data = false;
$rotating_array = array();
$next_value = false;
$next_label = false;
@lamguy
lamguy / Linux Static IP
Created September 23, 2015 15:37 — forked from fernandoaleman/Linux Static IP
How To Configure Static IP On CentOS 6
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static