Skip to content

Instantly share code, notes, and snippets.

@leonelsr
leonelsr / xmrigidle.ahk
Last active June 2, 2020 21:04
AutoHotkey XMRig controller tool - Dynamically changes XMRig settings when PC is idle for some time
#SingleInstance force ; Skips the dialog box and replaces the old instance automatically
#Persistent
SetWorkingDir %A_ScriptDir%
/*
* XMRig controller tool
*
* Can be used to dynamically change XMRig settings whenever PC is idle for some time
* At the bottom of this file, there is an example of config.json file for reference
<!DOCTYPE html><html lang="en"><head>
<title>SDDS CEVA | 30 do Hellboy</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
// ==UserScript==
// @name Globo Full Tab
// @namespace https://gist.github.com/leonelsr
// @version 0.1.3
// @downloadURL https://gist.github.com/leonelsr/095f42ff5904432d4532f27ce92b9b85/raw/GloboFullTab.user.js
// @description Cria um botão para deixar em Tela Cheia (ou "aba cheia") qualquer vídeo em Globo.com (inclusive G1, Globo Play ou Globosat Play).
// @author @leonelsr
// @match *://*.globo.com/*
// @grant none
// ==/UserScript==
@leonelsr
leonelsr / test-php-basic-auth.php
Created January 11, 2019 22:33 — forked from rchrd2/test-php-basic-auth.php
PHP basic auth example
<?php
function require_auth() {
$AUTH_USER = 'admin';
$AUTH_PASS = 'admin';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
$is_not_authenticated = (
!$has_supplied_credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS
@leonelsr
leonelsr / DESPERTADOR.cmd
Last active April 6, 2019 02:36
Despertador com windows batch e task scheduler
@echo off
SETLOCAL
SET mpchc="C:\Program Files\MPC-HC\mpc-hc64.exe"
SET imperial="C:\Users\Leonel\Music\John Williams\The Greatest Hits_ 1969-1999 Disc 1\10 'The Imperial March' from The Emp.m4a"
SET dontlie="C:\Users\Leonel\Music\The Black Eyed Peas\Monkey Business\04 Don't Lie.m4a"
SET hedwig="C:\Users\Leonel\Music\John Williams\Harry Potter And The Philosopher's Stone\19 Hedwig's Theme.m4a"
SET starwars="C:\Users\Leonel\Music\John Williams\The Greatest Hits_ 1969-1999 Disc 1\01 Star Wars (Main Title) [From Star.m4a"
@leonelsr
leonelsr / OldTwitterAvatar.user.js
Last active April 6, 2019 22:43
Twitter and Tweetdeck #OldTwitter Avatar
// ==UserScript==
// @name Twitter and Tweetdeck #OldTwitter Avatar
// @namespace http://tampermonkey.net/
// @version 0.1.2
// @downloadURL https://gist.githubusercontent.com/leonelsr/b105375be316540dbcc7e76dabcd02c6/raw/OldTwitterAvatar.user.js
// @description Bring the old square Avatar back to Twitter and TweetDeck!
// @author @leonelsr
// @match https://tweetdeck.twitter.com/
// @match https://twitter.com/*
// @grant none
@leonelsr
leonelsr / bash_background.vbs
Last active March 14, 2024 02:26
Run bash (Windows Subsystem for Linux) in background, in order to keep background processes running in WSL
' Windows Devs said on the developer feedback asking for cron, deamons and background tasks:
' "This first release of Bash/WSL doesn’t support background tasks, cron jobs, daemons, etc.
' Currently, when you close your last bash shell console window, we tear-down the Linux process
' chain in order to conserve resources."
'
' That's the workaround for now.
' You can run it on boot, for example, and it'll keep a instance of bash running alone in the background
' allowing background processes to run on WSL.
Set WshShell = CreateObject("WScript.Shell")

Keybase proof

I hereby claim:

  • I am leonelsr on github.
  • I am leonelsr (https://keybase.io/leonelsr) on keybase.
  • I have a public key ASAU8GXH2lcMuHHWLVNfvXym7VfTPeiPMQ344hgNSx1hGgo

To claim this, I am signing this object:

/* Use 100% CPU on multithreaded Windows systems */
#include <Windows.h>
#include <stdio.h>
#define NUM_THREADS 4
DWORD WINAPI mythread(__in LPVOID lpParameter)
{
printf("Thread inside %d \n", GetCurrentThreadId());
@leonelsr
leonelsr / resize-class.php
Created August 8, 2012 04:01
PHP Image crop and Resize helper class
<?php
# ========================================================================#
#
# Author: Jarrod Oberto
# Version: 1.1
# Date: 08-Aug-12
# Purpose: Resizes and saves or shows image
# Requires : Requires PHP5, GD library.
# Usage Example: