Skip to content

Instantly share code, notes, and snippets.

View paulofellix's full-sized avatar

Paulo Félix paulofellix

  • PF Labs
  • Manaus, AM - Brasil
View GitHub Profile
@paulofellix
paulofellix / oracle-lock.sql
Last active May 20, 2024 23:56
oracle find lock #database #sql
select 'alter system kill session ' || chr(39) || s.sid || ', ' || s.serial# || chr(39) || ' ' || 'immediate'|| ';', s.inst_id,
'kill -9 ' || p.spid, s.username, s.module
from gv$session s, gv$process p
where p.inst_id = s.inst_id
and p.addr = s.paddr
and s.type <> 'BACKGROUND'
and s.sid in (
SELECT DECODE(request, 0, sid, -1) sid
FROM gV$LOCK
WHERE (id1, id2, TYPE) IN (SELECT id1, id2, TYPE FROM GV$LOCK WHERE lmode = 0)
@paulofellix
paulofellix / postman-update.sh
Created July 27, 2023 03:00 — forked from lira/postman-update.sh
Install/Update postman or postman canary (beta) for linux. Tested in ubuntu 17.10 gnome3
#!/bin/bash
cd /tmp || exit
read -r -p "[s]table or [b]eta? [sS/bB] " choice
choice=${choice,,} # tolower
if [[ ! "$choice" =~ ^(s|b)$ ]]; then
exit
fi
if [[ "$choice" = "s" ]]; then
url=https://dl.pstmn.io/download/latest/linux64
name=Postman
@paulofellix
paulofellix / keyboard.md
Created October 6, 2022 17:43 — forked from ericdouglas/keyboard.md
Cedilla under C (ç) in 'US international' keyboard layout in Linux

Add English (US, alt. intl.)

It's because the cedilla module isn't loaded by default when the locale is set to en, so you have to change the configuration files for gtk to add them:

  1. Edit configuration files:
sudo vim /usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache

sudo vim /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache
@paulofellix
paulofellix / app.module
Created September 15, 2022 15:39
Logger Http Requests NestJS
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer): void {
consumer.apply(AppLoggerMiddleware).forRoutes('*');
}
}
@paulofellix
paulofellix / AuthyToOtherAuthenticator.md
Created September 27, 2021 15:41 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My guess is that Brian used the

@paulofellix
paulofellix / main.java
Created May 20, 2021 22:03
Converter Romano Para Arabico
private int traduzirNumeralRomano(String texto) {
int n = 0;
int numeralDaDireita = 0;
for (int i = texto.length() - 1; i >= 0; i--) {
int valor = (int) traduzirNumeralRomano(texto.charAt(i));
n += valor * Math.signum(valor + 0.5 - numeralDaDireita);
numeralDaDireita = valor;
}
return n;
}
@paulofellix
paulofellix / sample.service
Last active February 25, 2021 15:57
[Sample Service RHEL] #linux #script
# vi /etc/systemd/system/sample.service
[Unit]
Description=Description for sample script goes here
After=network.target
[Service]
Type=simple
ExecStart=/var/tmp/test_script.sh
TimeoutStartSec=0
@paulofellix
paulofellix / dCalendar
Last active August 19, 2021 15:18
[PowerBI] PowerBI Snippets
dCalendario =
VAR Calendario =
CROSSJOIN(
CALENDAR ("2020-01-01", TODAY()),
UNION (
ROW ( "Time", TIME ( 1, 0, 0 ) ),
ROW ( "Time", TIME ( 2, 0, 0 ) ),
ROW ( "Time", TIME ( 3, 0, 0 ) ),
ROW ( "Time", TIME ( 4, 0, 0 ) ),
ROW ( "Time", TIME ( 5, 0, 0 ) ),
@paulofellix
paulofellix / jquery.waituntilexists.js
Created July 21, 2020 16:39 — forked from md55/jquery.waituntilexists.js
bugfix: if handler do waituntilexists() again with same selector then new IntervalId will replace old one in intervals array before removeListener() call. So new Interval will be cleared instead of old, and old Interval will never be cleared.
;(function ($, window) {
var intervals = {};
var removeListener = function(selector) {
if (intervals[selector]) {
window.clearInterval(intervals[selector]);
intervals[selector] = null;
}
@paulofellix
paulofellix / gitkraken.desktop
Last active June 13, 2023 14:07
[Gnome Desktop Files] #gnome #linux
[Desktop Entry]
Name=GitKraken
Comment=Unleash your repo
GenericName=Git Client
Exec=/usr/share/gitkraken/gitkraken %U
Icon=gitkraken
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Development;RevisionControl;
MimeType=text/plain;