Skip to content

Instantly share code, notes, and snippets.

View tobsn's full-sized avatar

Tobsn tobsn

  • US/EU/SEA
View GitHub Profile
@lobodin
lobodin / README.md
Last active March 30, 2023 06:23
Import GeoNames.org cities data to mongodb.

#Generate cities data

  1. wget http://download.geonames.org/export/dump/cities15000.zip
  2. unzip cities15000.zip
  3. node geonames.js cities15000.txt

The result is json array of cities in the following format:

{

_id:

@bjinwright
bjinwright / .config
Created May 10, 2013 15:17
AWS Elastic Beanstalk container commands for installing mod_pagespeed. This example uses a Django application but just strip out commands 1 and 2 and it usable by any application. This is the follow up to the https://gist.github.com/bjinwright/5554958 Gist that shows how to setup the Apache conf file that makes this work.
container_commands:
01_collectstatic:
command: "django-admin.py collectstatic --noinput"
02_lesscss:
command: "lesscpy -x static/css/base.less > static/css/base.css"
03_setup_apache:
command: "cp enable_mod_pagespeed.conf /etc/httpd/conf.d"
04_rm_pagespeed:
command: "rm -rf /pagespeed/ebextensions"
05_mkdir_pagespeed:
@dragolabs
dragolabs / nginx-vbulletn.conf
Created August 2, 2013 04:06
nginx config for vbulletin 5 forum. And read the comments in config.php: // ****** Base URLs ****** // The following settings all deal with the url of your forum. // If set incorrectly your site/software will not function correctly. // These urls should NOT include a trailing slash <------- !!! // This is the url and web path of your root vBulle…
server {
listen 80;
server_name forum.example.com;
root /var/www/example_forum/;
index index.php;
access_log /var/log/nginx/forum.example.access.log main;
error_log /var/log/nginx/forum.example.error.log;
@mattzuba
mattzuba / 01_httpd_phpfpm.config
Last active December 20, 2022 19:53
Apache 2.4 / PHP-FPM 5.5 on Amazon Elastic Beanstalk
packages:
yum:
php55-fpm: []
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/26_phpfpm_config.sh":
mode: "000755"
owner: root
group: root
content: |
@tobsn
tobsn / base
Created May 28, 2014 14:28
nginx - sub_filter replace head with the current folder as base href for sub project folder structure
location / {
if ($uri ~* ^/([^.\?/]+)) {
set $foldername "$1";
}
sub_filter "<head>" "<head><base href=\"${scheme}://${host}/${foldername}/\">";
}
{
"Mississippi": [30.1477890014648, 34.9960556030273, -91.6550140380859, -88.0980072021484],
"Oklahoma": [33.6191940307617, 37.0021362304688, -103.002571105957, -94.4312133789062],
"Delaware": [38.4511260986328, 39.8394355773926, -75.7890472412109, -74.9846343994141],
"Minnesota": [43.4994277954102, 49.3844909667969, -97.2392654418945, -89.4833831787109],
"Illinois": [36.9701309204102, 42.5083045959473, -91.513053894043, -87.0199203491211],
"Arkansas": [33.0041046142578, 36.4996032714844, -94.6178131103516, -89.6422424316406],
"New Mexico": [31.3323001861572, 37.0001411437988, -109.050178527832, -103.000862121582],
"Indiana": [37.7717399597168, 41.7613716125488, -88.0997085571289, -84.7845764160156],
"Louisiana": [28.9210300445557, 33.019458770752, -94.0431518554688, -88.817008972168],
@umidjons
umidjons / random-hash-string-php.md
Created April 29, 2015 10:56
Generate random hash string in PHP

Generate random hash string in PHP

<?php
function randHash($len=32)
{
	return substr(md5(openssl_random_pseudo_bytes(20)),-$len);
}
@nmcgann
nmcgann / install-cluster-client.config
Created January 13, 2016 09:10
AWS Elastic Beanstalk .ebextensions config to install Elasticache memcached cluster client (PHP 5.6)
files:
"/home/ec2-user/install-cluster-client.sh":
mode: "000744"
owner: root
group: root
content: |
#!/bin/bash
#hide old ini
if [ -a /etc/php.d/50-memcached.ini ]
then
@rpgreen
rpgreen / master.vm
Created February 23, 2016 00:02
API Gateway "Send Everything" Mapping Template
## API Gateway "Send Everything" Mapping Template - Ryan Green - ryang@ryang.ca
## See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
#set($allParams = $input.params())
{
"body-json" : "$input.json('$')",
"params" : {
#foreach($type in $allParams.keySet())
#set($params = $allParams.get($type))
"$type" : {
#foreach($paramName in $params.keySet())
@aaronhoffman
aaronhoffman / aws-sns-event-template-with-actual-ses-deliverynotification-sns-message
Last active January 15, 2019 19:04
Lambda function to process a Amazon SES Delivery Notification message from a SNS Topic into a DynamoDB Table
{
"Records": [
{
"EventSource":"aws:sns",
"EventVersion":"1.0",
"EventSubscriptionArn":"arn:aws:sns:us-west-2:xxxx:xxxx",
"Sns": {
"Type":"Notification",
"MessageId":"88B1B251-2E92-4FC3-BFAA-E3BBD0BAB10A",
"TopicArn":"arn:aws:sns:us-west-2:881222951025:survey-tool-ses-delivery",