Skip to content

Instantly share code, notes, and snippets.

View thubaidamasceno's full-sized avatar

Thubaí Chaves thubaidamasceno

View GitHub Profile
apiVersion: v1
data:
datasource.yaml: |
apiVersion: 1
datasources:
- name: mimir
uid: cdgqpakkxq2gwd
type: prometheus
url: http://grafana-mimir-service:9090/prometheus
isDefault: true

NAT configuration in Fedora 27

Warning Still under development

Delete and flush

iptables --flush            # Flush all the rules in filter and nat tables
iptables --table nat --flush
iptables --delete-chain
@thubaidamasceno
thubaidamasceno / Connection Pooling in MongoDB with Node.js
Created September 12, 2022 13:44 — forked from adityaparmar03/Connection Pooling in MongoDB with Node.js
This is a code for connection pooling in mongoDB in NodeJS. In below code, MongoJS file establish connection and appJS file call MongoJS file for establishing connection. Then, Other routes use this same connection.
/* Mongo.js*/
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/yourdatabasename";
var assert = require('assert');
var connection=[];
// Create the database connection
establishConnection = function(callback){
@thubaidamasceno
thubaidamasceno / ScrolledFrame.py
Created July 30, 2022 21:27 — forked from JackTheEngineer/ScrolledFrame.py
Tkinter python Scrolled Window / Frame / Canvas with Mousewheel support ( based upon EugeneBakin 's scrframe.py )
from tkinter import ttk
import tkinter as tk
import functools
fp = functools.partial
class VerticalScrolledFrame(ttk.Frame):
"""
A pure Tkinter scrollable frame that actually works!
* Use the 'interior' attribute to place widgets inside the scrollable frame
* Construct and pack/place/grid normally
@thubaidamasceno
thubaidamasceno / ipc_test.py
Created July 30, 2022 15:12 — forked from 140am/ipc_test.py
Simple Python / ØMQ IPC (Inter Process Communication) performance benchmark
""" Simple IPC benchmark test
Test throughput of 512 KB messages sent between two python processes using:
- multiprocessing pipe
- zeroMQ PUSH/PULL
- zeroMQ DEALER/DEALER
Result:
@thubaidamasceno
thubaidamasceno / ThreadSafeSignal.py
Created July 30, 2022 01:32 — forked from jim-easterbrook/ThreadSafeSignal.py
Emit a PyQt signal from any Python thread.
class ThreadSafeSignal(QtCore.QObject):
signal = QtCore.pyqtSignal(object)
def __init__(self, parent=None):
# initialise in Qt thread
super(QtCore.QObject, self).__init__(parent)
self.queue = deque()
self.rsock, self.wsock = socket.socketpair()
self.notifier = QtCore.QSocketNotifier(
self.rsock.fileno(), QtCore.QSocketNotifier.Read)
self.notifier.activated.connect(self.recv)
@thubaidamasceno
thubaidamasceno / angles.py
Created July 25, 2022 01:48 — forked from phn/angles.py
Python classes and functions for working with angles.
# Code moved to http://github.com/phn/angles.
@thubaidamasceno
thubaidamasceno / python_console.py
Created June 5, 2022 00:08 — forked from olisolomons/python_console.py
Python interpreter console tkinter widget
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
import io, hashlib, queue, sys, time, threading, traceback
import code
class Pipe:
"""mock stdin stdout or stderr"""
@thubaidamasceno
thubaidamasceno / extend-trial-jetbrains-windows.bat
Created August 1, 2021 03:52
JetBrains IDE trial reset windows
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"
@thubaidamasceno
thubaidamasceno / gvim.sh
Created June 24, 2020 16:03 — forked from lifthrasiir/gvim.sh
Running Windows gvim.exe from WSL
gvim() {
local args rawargs path base usegvim=1 noopt=
declare -a args
rawargs=("$@")
while (($#)); do
case "$noopt$1" in
-[cSdirsTuUwW]|--cmd|--remote-expr|--remote-send|--servername|--version)
args[${#args[@]}]="$1"
rawargs[${#args[@]}]="$1"
shift