Skip to content

Instantly share code, notes, and snippets.

View pvgomes's full-sized avatar
:octocat:
Focusing

Paulo Victor L.L. Gomes pvgomes

:octocat:
Focusing
View GitHub Profile
@pvgomes
pvgomes / commands.sh
Created December 21, 2020 19:56
CSGO mac optimization
sudo renice -20 -p `ps aux | grep csgo_osx | grep -v grep | awk '{print $2}'`
@pvgomes
pvgomes / README.md
Last active April 23, 2020 21:07
fix ubuntu and mysql timezone

fix ubuntu timezone

sudo dpkg-reconfigure tzdata

fix mysql timezone

If you're struggling with the error:

@pvgomes
pvgomes / reset_sidekiq.rb
Created April 17, 2020 17:51
an example to reset sidekiq counter
require 'sidekiq/api'
Sidekiq.redis {|c| c.del('stat:processed') }
Sidekiq.redis {|c| c.del('stat:failed') }
# Sidekiq.redis { |r| r.lrange "queue:app_queue", 0, -1 }
#
# # Count messages in queue
# # default_queue = Sidekiq::Queue.new
@pvgomes
pvgomes / Dockerfile
Created April 7, 2020 19:32
Docker file example
FROM mysql:8.0.19
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git
@pvgomes
pvgomes / template.yaml
Created July 4, 2019 00:06
SAM template for symfony with bref on AWS Lambda
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
Environment:
Variables:
APP_ENV: prod
Resources:
@pvgomes
pvgomes / python3_s3_to_redshift_loader.py
Created January 23, 2019 16:16
Load data from S3 to Redshift using Python3
############ REQUIREMENTS TO INSTALL ####################
# THIS SCRIPT use category table from AWS sample data (https://docs.aws.amazon.com/redshift/latest/gsg/rs-gsg-create-sample-db.html)
# we use this sample data s3://awssampledbuswest2/tickit/category_pipe.txt
###### Linux users
#`sudo apt-get install libpq-dev`
###### Mac users
#`brew install libpq`
#!/usr/bin/env bash
shopt -s extglob
set -o errtrace
set -o errexit
rvm_install_initialize()
{
DEFAULT_SOURCES=(github.com/rvm/rvm bitbucket.org/mpapis/rvm)
@pvgomes
pvgomes / newrelic-sysmond.sh
Created October 15, 2017 19:55
newrelic-sysmond
#! /bin/sh
#
### BEGIN INIT INFO
# Provides: newrelic-sysmond
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $named
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@pvgomes
pvgomes / restart.py
Last active October 9, 2017 20:26
restartPy
import os
import time
quantity = int(input("Quantity to restart: "))
while(quantity > 0):
print("Runnint restart %s" % (str(quantity)))
time.sleep(3)
os.system("initctl restart worker");
quantity = quantity - 1
@pvgomes
pvgomes / API Gateway html form to json
Created September 28, 2017 19:59
API Gateway html form to json
## convert HTML POST data or HTTP GET query string to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#if ($context.httpMethod == "POST")
#set($rawAPIData = $input.path('$'))
#elseif ($context.httpMethod == "GET")
#set($rawAPIData = $input.params().querystring)
#set($rawAPIData = $rawAPIData.toString())
#set($rawAPIDataLength = $rawAPIData.length() - 1)
#set($rawAPIData = $rawAPIData.substring(1, $rawAPIDataLength))