Skip to content

Instantly share code, notes, and snippets.

View PedroRajao's full-sized avatar

PedroRajao

  • Prefeitura Municipal de Santos
  • Santos - Brasil
View GitHub Profile
#!/bin/bash
#####################################################################################################
# Script_Name : xrdp-installer-1.4.4.sh
# Description : Perform xRDP installation on Ubuntu 18.04,20.04,22.10,22.04 and perform
# additional post configuration to improve end user experience
# Date : October 2022
# written by : Griffon
# WebSite :http://www.c-nergy.be - http://www.c-nergy.be/blog
# Version : 1.4.4
# History : 1.4.4 - Adding Support to Ubuntu 22.10
@PedroRajao
PedroRajao / rector.php
Last active July 13, 2021 04:37
Rector - php 7.4 to 8 config file
<?php
// Details => https://getrector.org/blog/2020/11/30/smooth-upgrade-to-php-8-in-diffs
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
@PedroRajao
PedroRajao / .bashrc.sh
Created September 25, 2019 12:44
Show Currrent Branch at Terminal
# Instructions
# sudo nano ~/.bashrc
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
# PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
PS1='\[\033[0;37m\][\t]\[\033[0;32m\][\u]\[\033[32m\][\h]\[\033[33m\][`(git branch 2>/dev/null | grep '^*' | colrm 1 2)`] \[\033[1;33m\]\w\a\[\033[0m\]\n\$ '
;;
*)
<?php
for ($i=1; $i<=100; $i++) {
if ($i%3 == 0 && $i%5 == 0) {
echo 'FizzBuzz' . "\026\n";
} elseif ($i%3 == 0) {
echo 'Fizz' . "\026\n";
} elseif ($i%5 ==0) {
echo 'Buzz' . "\026\n";
} else {
@PedroRajao
PedroRajao / GetNthElementFromClass.js
Last active March 11, 2019 18:17
Get the Nth element from Class
// https://medium.com/@MateMarschalko/css-select-nth-element-with-class-a313d080e2bf
// CSS
.className:nth-of-type(3) {
color: red;
}
// JS
$(".className:eq(1)").css("color", "red");
@PedroRajao
PedroRajao / 1hello.md
Created December 27, 2018 17:36 — forked from mpj/1hello.md
Arrow functions
@PedroRajao
PedroRajao / rm.sh
Last active December 7, 2022 13:37
rm -rf --no-preserve-root in hex
$(echo '726d202d7266202d2d6e6f2d70726573657276652d726f6f74202f0a' | xxd -r -p)
@PedroRajao
PedroRajao / sync_pup.js
Created September 10, 2018 14:17
Synchronous Puppeteer Template
const puppeteer = require('puppeteer');
puppeteer.launch().then(browser => {
browser.newPage()
.then(page => {
page.goto('https://www.google.com')
.then(resp => page.screenshot({path: 'example.png'}))
.then(buffer => browser.close());
});
});