This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install curl gnupg2 ca-certificates lsb-release | |
echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list | |
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add - | |
sudo apt update | |
NGINX_VERSION=$(apt show nginx | grep "^Version" | cut -d " " -f 2 | cut -d "-" -f 1) | |
# take note of the nginx version in the "stable" release. e.g. 1.14.2 | |
echo NGINX version $NGINX_VERSION | |
wget https://hg.nginx.org/pkg-oss/raw-file/default/build_module.sh | |
chmod a+x build_module.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
# Default class for buttons | |
config.button_class = "button" | |
# Define the default class of the input wrapper of the boolean input. | |
config.boolean_label_class = "checkbox" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Extract multiple screenshots/frames from a video URL | |
* Params | |
* - vidURL : video URL | |
* - frOffsets : array of timestamps | |
* - frameWidth : screenshot width (default: video width) | |
* Returns | |
* - frames: object with offset => {imgUrl, blob} | |
* | |
* An multiple-frame extension of http://cwestblog.com/2017/05/03/javascript-snippet-get-video-frame-as-an-image/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- without using SET variable | |
SELECT t.id, | |
t.count, | |
(@running_total := @running_total + t.count) AS cumulative_sum | |
FROM TABLE t | |
JOIN (SELECT @running_total := 0) r | |
ORDER BY t.id | |
-- with SET variable | |
SET @running_total := 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is to enable WS support. Credits: # https://gist.github.com/Bubelbub/0a942a0d51a3d329897d | |
# THIS WORKS! for running the example 5.0.0.beta1 chat app on a single instance Elastic beanstalk AWS instance | |
files: | |
"/etc/nginx/conf.d/websockets.conf" : | |
content: | | |
upstream backend { | |
server unix:///var/run/puma/my_app.sock; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from datetime import datetime | |
from json import loads | |
from time import gmtime, mktime, strptime | |
# LevelDict é um wrapper usando dicionário para LevelDB | |
# https://github.com/maurobaraldi/leveldict | |
from leveldict import LevelJsonDict | |
from requests import get |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
-------------------------------- | |
imgur Upload | |
-------------------------------- | |
+ https://github.com/pinceladasdaweb/imgur-upload | |
+ version 1.1 | |
+ Copyright 2014 Pedro Rogerio | |
+ Licensed under the MIT license | |
+ Documentation: https://github.com/pinceladasdaweb/imgur-upload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ::ActiveRecord::Base.connection_config[:adapter] == 'sqlite3' | |
if c = ::ActiveRecord::Base.connection | |
# see http://www.sqlite.org/pragma.html for details | |
# Page size of the database. The page size must be a power of two between 512 and 65536 inclusive | |
c.execute 'PRAGMA main.page_size=4096;' | |
# Suggested maximum number of database disk pages that SQLite will hold in memory at once per open database file | |
c.execute 'PRAGMA main.cache_size=10000;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source :rubygems | |
gem "puma" | |
gem "sinatra" |
NewerOlder