Skip to content

Instantly share code, notes, and snippets.


Alonisser alonisser

View GitHub Profile
View setInterval-bunching.js
let i = 0
const start =
setInterval(() => console.log(++i, - start), 1000)
for (let i = 0; i < 10000000000; ++i) {
Math.cos(37863443 * Math.exp(23749374))
niranjv /
Last active Feb 18, 2021
Change Python logger format in AWS Lambda
# Python logger in AWS Lambda has a preset format. To change the format of the logging statement,
# remove the logging handler & add a new handler with the required format
import logging
import sys
def setup_logging():
logger = logging.getLogger()
for h in logger.handlers:
View gulpfile.config.js
'use strict';
var config = {
sass : {
errLogToConsole: true,
outputStyle: 'compressed'
bower: './bower_components',
source: {
main: '.src/',
marcellodesales /
Last active Feb 10, 2021
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
# Author: Marcello de Sales (
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (
### Installation:
# * Add the Policy EC2:DescribeTags to a User
tomconte /
Last active Feb 15, 2018
Send messages to an Azure Event Hub using the Apache Qpid Proton AMQP library.
# Send messages to an Azure Event Hub using the Apache Qpid Proton AMQP library.
import sys
import commands
from proton import *
# Event Hub address & credentials
# amqps://<keyname>:<key>@<namespace><eventhubname>
erez-rabih / nginx-dashboard.json
Last active Aug 29, 2015
Nginx Dashboard For Logstash
View nginx-dashboard.json
"title": "Nginx Web",
"services": {
"query": {
"list": {
"0": {
"query": "response:[200 TO 299]",
"alias": "OK",
"color": "#7EB26D",
"id": 0,
mlouro / gulpfile.js
Last active Sep 22, 2020
gulpfile.js with browserify, jshint, libsass, browserSync for livereload, image optimization and system notifications on errors
View gulpfile.js
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var exec = require('child_process').exec;
var notify = require('gulp-notify');
eezis / update postgres last
Last active Oct 7, 2017
A code snippet to update the "last_value" of postgres's sequence generator when it is out of sync with the actual values in your tables.
View update postgres last
This utility addresses the InegrityError that occurs when you try to add a new record to
(probably a recently ported) postgres database while using Django, here's more . . .
duplicate key value violates unique constraint "<app>_<table>_pkey"
DETAIL: Key (id)=(2) already exists.
The problem here is that the Postgres sequence generators are out of sync with your data.
Here's a good overview:
Stanback / nginx.conf
Last active Feb 3, 2021
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service ( of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
View nginx.conf
# Note (November 2016):
# This config is rather outdated and left here for historical reasons, please refer to for the latest setup information
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol
server {
listen 80;
listen [::]:80;
root /path/to/your/htdocs;
plentz / nginx.conf
Last active Feb 27, 2021
Best nginx configuration for improved security(and performance). Complete blog post here
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048