Skip to content

Instantly share code, notes, and snippets.

View lotharthesavior's full-sized avatar

Sávio Resende lotharthesavior

View GitHub Profile
@lotharthesavior
lotharthesavior / openmetrics.php
Created June 19, 2022 13:50 — forked from johanjanssens/openmetrics.php
Openswoole - getMetrics()
<?php
/**
* Extracted from https://github.com/openswoole/swoole-src/blob/f191c0b0a98e9b97f5c81d4877f450c863e6c36d/ext-src/php_swoole_library.h#L6999
*
* Changes:
*
* - Added 'service' label
* - Added additional label support
*
@lotharthesavior
lotharthesavior / Autoloader.php
Created May 21, 2021 05:58 — forked from Nilpo/Autoloader.php
A simple recursive PHP autoloader using the RecursiveDirectoryIterator.
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Rob Dunham
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@lotharthesavior
lotharthesavior / xrandr-scale.sh
Created March 25, 2019 20:36 — forked from 3v1n0/xrandr-scale.sh
Xrandr Scaling script, with auto panning when scaling down
#!/bin/bash
export LANG=C
output=$1;
scale=$2;
if [ -n "$output" ] && ! (xrandr --listmonitors | grep -qw "$output"); then
echo "Invalid output: '$output'";
exit 1;
@lotharthesavior
lotharthesavior / gist:0f9c33175caad0052d79
Last active January 8, 2016 21:09 — forked from yurydelendik/gist:f2b846dae7cb29c86d23
Hightlight Selected Text in PDFJS
function HighlightSelectedText()
{
var pageIndex = window.PDFViewerApplication.pdfViewer.currentPageNumber - 1;
var page = window.PDFViewerApplication.pdfViewer.pages[pageIndex];
var pageElement = page.canvas.parentElement;
var pageRect = page.canvas.getClientRects()[0];
var selectionRects = window.getSelection().getRangeAt(0).getClientRects();
var viewport = page.viewport;
var i = 0;