Skip to content

Instantly share code, notes, and snippets.

View pwscherer's full-sized avatar

pwscherer

View GitHub Profile
@pwscherer
pwscherer / mysqlbackup.sh
Created January 18, 2022 03:37 — forked from juffaz/mysqlbackup.sh
Mysql backup cron
CREATE USER 'mysqlbackup'@'localhost' IDENTIFIED BY 'secret';
GRANT LOCK TABLES,RELOAD,SELECT,SHOW VIEW ON *.* TO 'mysqlbackup'@'localhost';
root@debian9:/root# crontab -l
0 0 * * * /root/mysqlbackup.sh
root@debian9:/root# cat /root/mysqlbackup.sh
#!/bin/bash
##### without gzip compress - raw backup
#mysqldump -u mysqlbackup -psecret --all-databases --quick --lock-all-tables > /backup/mysql-$HOSTNAME-$(date +%Y-%m-%d-%H.%M.%S).sql
@pwscherer
pwscherer / brazilian_phone_mask_with_area_code.js
Created January 4, 2022 01:22 — forked from MauricioMoraes/brazilian_phone_mask_with_area_code.js
Mask for 8 or 9 digit phones in brazilian format with area code (ddd) - Using Jquery.inputmask plugin
// Using jquery.inputmask: https://github.com/RobinHerbots/jquery.inputmask
// For 8 digit phone fields, the mask is like this: (99) 9999-9999
// For 9 digit phone fields the mask is like this: (99) 99999-9999
function setupPhoneMaskOnField(selector){
var inputElement = $(selector)
setCorrectPhoneMask(inputElement);
inputElement.on('input, keyup', function(){
setCorrectPhoneMask(inputElement);
});
@pwscherer
pwscherer / script.sh
Created March 10, 2019 02:21 — forked from phpcodertop/script.sh
install ipvtl trial and hack its trial
#!/bin/bash
echo "Downloading ipvtl Software \n"
cd /home
wget http://www.ipvideotrans.com/download/ipvtl_trial-x64.tar.xz
@pwscherer
pwscherer / ffmpeg-minimalist-build-nvenc-static.md
Created March 10, 2019 01:15
This gist will show you how to build a minimalist, statically-linked ffmpeg binary under the ~/bin subdirectory on your home on Ubuntu 16.04LTS. Comes with (optiona) NPP, CUDA and NVENC capabilities. See notes in the warning section.

Minimalist static FFmpeg build on Ubuntu 18.04 with Nvidia NVENC enabled.

Original guide with a standard build is here.

With this guide, I'm adding more instructions to enable support for NVIDIA CUVID and NVIDIA NPP for enhanced encode and decode performance.

Warning:

If all you require is NVENC's enablement, you do NOT need the CUDA SDK. The nv-codec-headers (below) is ALL you require.

@pwscherer
pwscherer / upgrade.sh
Created June 28, 2018 14:41 — forked from artemsky/upgrade.sh
PHP 7.2 Cloud9
sudo apt-get install python-software-properties -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.2 php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
sudo apt-get install libapache2-mod-php7.2 -y
sudo a2dismod php5
sudo a2enmod php7.2
sudo service apache2 restart
@pwscherer
pwscherer / laraveloncodeanywhere.md
Created June 27, 2018 14:59 — forked from mumtazhqq/laraveloncodeanywhere.md
Step by step to Setup latest laravel on codeanywhere from centos stack

Installing the latest laravel on codeanywhere

CodeAnywhere is a great cloud IDE to create web apps but it lacks that latest install of Laravel. So I used blank centos6.5 stack as my base and then following this step to setup laravel environtment.

first update the yum package by running

sudo yum update
<?php
namespace safed\Traits;
Trait DataTablesTrait{
/**
* receices the model collection with records and return a json needed for the datatable
* receives de name of the Controller to generate correct URLs
* receives the customfields (for relations) that you want to return with the json
@pwscherer
pwscherer / watchdog.sh
Created April 29, 2018 18:08 — forked from vodolaz095/watchdog.sh
watchdog.sh script for checking server running not mine, i stole it)
#!/bin/bash
# Service watchdog script
# Put in crontab to automatially restart services (and optionally email you) if they die for some reason.
# Note: You need to run this as root otherwise you won't be able to restart services.
#
# Example crontab usage:
#
# Strict check for apache2 service every 5 minutes, pipe results to /dev/null
# */5 * * * * sh /root/watchdog.sh apache2 "" > /dev/null
#

Tópicos de estudo para JavaScript

Base JS

  • Lexical Scopes
  • Protótipos
  • Funções Construtoras
  • ES6 Class
  • Factory
  • Mixins