Skip to content

Instantly share code, notes, and snippets.

@DerexScript
DerexScript / Laravel_Global_Installer.sh
Created July 21, 2021 00:11 — forked from arvinesmaeily/Laravel_Global_Installer.sh
Laravel Global Installer (Including PHP, Composer and PHP extensions)
#!/bin/sh
sudo apt-get update && apt-get upgrade
sudo apt-get install php
sudo apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
function str_replace_last(search, replace, str){
let pos = str.lastIndexOf('webp');
let search_length;
if(pos != -1){
search_length = search.length;
str = str.substring(0, pos)+replace+str.substring(pos+search_length);
}
return str;
}
<?php
//antes de trabalhar com essa classe, certifique-se de ativar a extensão gd do php
//fiz essa classe a fim de testar formas pra tratar imagem usando php
//porem existe bibliotecas bem elaboradas para esses fim..
// https://github.com/gumlet/php-image-resize
// http://image.intervention.io/
class Img
{
private function redimensionar($path, $fileName = "", $width, $height, $proportionDirection, $thumbnailPath)
{
@DerexScript
DerexScript / license.key
Created October 3, 2020 00:15
Sublime Text 3 Build 3207 & Build 3211
----- BEGIN LICENSE -----
Member J2TeaM
Single User License
EA7E-1011316
D7DA350E 1B8B0760 972F8B60 F3E64036
B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD
FA0A2ABE 25F65BD8 D51458E5 3923CE80
87428428 79079A01 AA69F319 A1AF29A4
A684C2DC 0B1583D4 19CBD290 217618CD
5653E0A0 BACE3948 BB2EE45E 422D2C87
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="Abrir o prompt de comando(Admin) aqui"
"Extended"=""
"Icon"="cmd.exe"
"NeverDefault"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@DerexScript
DerexScript / httpRequestNodeJs.js
Created May 16, 2020 01:49
Node.js HTTP request
const https = require('https')
let getRequest = (url, path) => new Promise((resolve, reject)=>{
const options = {
hostname: url,
port: 443,
path: path,
method: 'GET',
headers: {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'
@DerexScript
DerexScript / validarTelefone.php
Last active May 8, 2020 05:26
Validação com pattern html!
<?php
if(isset($_POST['telphone'])){
$re = '/\(?\d{2}\)?\s?\d{4,5}[-?|\s?]?\d{4}/m';
preg_match_all($re, $_POST['telphone'], $matches, PREG_SET_ORDER, 0);
if($matches != null){
echo "<h2 style=\"color: white;\">Parabéns Numero Validado Com Sucesso!</h2>";
echo "<h3>".$matches[0][0]."</h3>";
$novo_numero = str_replace("(", "", $matches[0][0]);
$novo_numero = str_replace(")", "", $novo_numero);
$novo_numero = str_replace("-", "", $novo_numero);
@DerexScript
DerexScript / getRequestHeader.cs
Created April 22, 2020 00:52
get request header dotnet 3.1 C #
//check if request header exists
bool isLanguage = this.Request.Headers.ContainsKey("Accept-Language1");
string lang = this.Request.Headers["Accept-Language"];
//string h = return string.Join("\n", this.Request.Headers.Select(x => $"{x.Key}: {x.Value}"));
//Middleware
public string tt([FromHeader(Name = "X-Forwarded-For")] string remoteIP) {
Console.WriteLine(remoteIP);
@DerexScript
DerexScript / curl_jsoncpp_example.cpp
Created March 30, 2020 10:16 — forked from connormanning/curl_jsoncpp_example.cpp
Curl HTTP GET and JsonCpp parsing - basic functionality
#include <cstdint>
#include <iostream>
#include <memory>
#include <string>
#include <curl/curl.h>
#include <json/json.h>
namespace
{
#include <windows.h>
#include <stdio.h>
#define INITIAL_BUFFER (MAX_PATH * 5)
char *listAllDirectories(char *path) {
WIN32_FIND_DATA data;
size_t bufferSize = INITIAL_BUFFER;
char *directories = (char*)calloc(1, bufferSize);
char *buffer = directories;