Skip to content

Instantly share code, notes, and snippets.

View ArthurHoaro's full-sized avatar

ArthurHoaro ArthurHoaro

  • CodeSignal
  • Lynchburg, VA, USA
  • 02:05 (UTC -04:00)
View GitHub Profile
@ArthurHoaro
ArthurHoaro / github_latest.sh
Last active November 10, 2020 10:25
Get Github latest release version
#!/bin/bash
if [[ $# != 1 ]]; then
echo "Usage: github_latest \"<repo author>/<repo name\""
exit 1
fi
curl -s "https://api.github.com/repos/$1/releases/latest" | jq -r '.tag_name'
@ArthurHoaro
ArthurHoaro / userstyle.css
Created October 26, 2020 12:46
Google Search Filter Dark
div.gsfHighlightResult {
background-color: #05200d !important;
color: #fff !important;
}
div.gsfHighlightResult div > span {
color: #fff !important;
}
div.gsfHighlightResult a {
@ArthurHoaro
ArthurHoaro / css-selectors.md
Created July 28, 2020 09:49 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
@ArthurHoaro
ArthurHoaro / generate_templates.php
Last active September 2, 2017 11:25
Shaarli template cache generator
<?php
/**
* Shaarli template cache generator
*
* This script is used to generate Shaarli's RainTPL cache files for translations.
* See http://shaarli.readthedocs.io/en/master/Translations/
*
* Usage:
* 1. Remove all PHP files in <shaarli's directory>/tmp/
@ArthurHoaro
ArthurHoaro / jwt.php
Created January 17, 2017 17:18
Example PHP JWT token generation using SHA512 encryption
<?php
function base64url_encode($data) {
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
}
function generateJwtToken($secret) {
$header = base64_encode('{
"typ": "JWT",
"alg": "HS512"
@ArthurHoaro
ArthurHoaro / socialapi.php
Created April 16, 2016 11:40
Firefox Social API - Text bug
<?php
var_dump($_SERVER['QUERY_STRING']);
?>
<!DOCTYPE html>
<html>
<head></head>
<body>
<a onclick="activateFirefoxSocial(this)">Add</a>
<?php
stream_context_set_default(array(
'http' => array(
'method' => 'GET',
'timeout' => 10,
'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:20.0; Favicon; +https://github.com/ArthurHoaro/favicon) Gecko/20100101 Firefox/32.0\r\n",
)
)
);
@ArthurHoaro
ArthurHoaro / jenkins-bookmarklet
Created December 23, 2013 10:54
Bookmarklet to Highlight WARN / ERROR in Jenkins
javascript:{var elems = document.getElementsByTagName('pre'), i, j;
for (i in elems) {
if(elems[i].id.indexOf("out") == -1) {
var lines = elems[i].innerHTML.split("\n");
var out = "";
for( j in lines ) {
if(lines[j].length > 0 && (""+lines[j]).indexOf("[ERROR]") > 0) {
lines[j] = "<span style=\"background-color:red;color:white\">" + lines[j] + "</span>";
}
else if(lines[j].length > 0 && (""+lines[j]).indexOf("[WARN]") > 0) {
@ArthurHoaro
ArthurHoaro / RemoveAntiAdblock.greasemonkey.js
Created August 3, 2013 11:22
GreaseMonkey: Remove anti-adblock called by setTimeout()
// ==UserScript==
// @name RemoveAntiAdblock
// @namespace raa
// @include http://www.WEBSITE.TLD/*
// @version 1
// ==/UserScript==
// Thanks to http://stackoverflow.com/a/8345837
// Set a fake timeout to get the highest timeout id
var highestTimeoutId = setTimeout(";");
<?php
// original: https://github.com/stormuk/storm-twitter + stevelacey patch
if(!isset($_GET['u'])) { header("HTTP/1.0 404 Not Found"); die('no username provided');}
$screenName = $_GET['u'];
require('StormTwitter.class.php');
require('config.php');
// configuration control
if($config['key'] == '' or $config['secret'] == '' or $config['token'] == '' or $config['token_secret'] == '') { header("HTTP/1.0 404 Not Found"); die('missing API credentials in config.php'); }