Skip to content

Instantly share code, notes, and snippets.

View AlexRNL's full-sized avatar

Alex Barféty AlexRNL

View GitHub Profile
@AlexRNL
AlexRNL / BSAdFieldUnlocker.js
Created October 8, 2012 20:48
Script to unlock text fields on BetaSeries
javascript:function unlockAd () {
var el = document.getElementsByClassName('ayl_response_input')[0];
el.removeAttribute('disabled');
el.removeAttribute('value');
el.focus();
}
unlockAd();
@AlexRNL
AlexRNL / checkEpisodes.js
Last active December 11, 2015 15:59
Script which allows to mark several episodes as selected when editing a series on theTVDB.To use it, copy the content of the gist and create a new bookmark with the content instead of the URL/link field.Tested and validated on Opera, Chrome, Firefox.
javascript:function checkField (field, rangeStart, rangeEnd) {
for (i = rangeStart-1; i < field.length && i <= rangeEnd-1; i++)
field[i].checked = true;
}
episodeCheckBox = document.getElementsByName('episode_selected[]');
checkField(episodeCheckBox, prompt("Enter the first episode to check", "1"), prompt("Enter the last episode to check", episodeCheckBox.length));
@AlexRNL
AlexRNL / BSDateFormatter.java
Created March 14, 2013 14:25
Transform timestamps in between <date></date> tags. in readable format.
package xml;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
@AlexRNL
AlexRNL / SleepPrevent.java
Last active December 15, 2015 20:29
Utility to avoid a computer to go to sleep.
package sleep_prevent;
import java.awt.AWTException;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
import java.awt.Robot;
import java.util.logging.Level;
import java.util.logging.Logger;
@AlexRNL
AlexRNL / clean-upProfile.xml
Created April 8, 2013 13:17
XML configuration files for a proper Eclipse clean-up, template and formatter configuration.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="2">
<profile kind="CleanUpProfile" name="Perso" version="2">
<setting id="cleanup.format_source_code" value="true"/>
<setting id="cleanup.add_missing_annotations" value="true"/>
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
<setting id="cleanup.remove_unused_private_types" value="true"/>
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
@AlexRNL
AlexRNL / UIManagerColorKeys.java
Created June 30, 2013 18:53
Snippet for generating the list of color keys availble in Swing's UIManager.
package com.sun.test;
import java.awt.Color;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.logging.Logger;
import javax.swing.UIManager;
@AlexRNL
AlexRNL / gist:6219859
Last active December 21, 2015 00:28 — forked from hay/gist:1351230
<!doctype html>
<html>
<head>
<title></title>
<style>
body {
background: white;
text-align: center;
padding: 20px;
font-family: Georgia, serif;
@AlexRNL
AlexRNL / EndOfLineDocToJavadoc
Last active March 30, 2016 16:30
Java parsing regexp
Find: "^(\s+)(.*;)\s+\/\*\*?(.*)$"
Replace with: "\1/**\3\n\1\2"
@AlexRNL
AlexRNL / MathUtils.java
Last active August 29, 2015 14:12
Method to compute the maximum in a collection of number
public class MathUtils {
/**
* Return the maximum number in a collection.<br />
* @param collection
* the collection.
* @return the maximum value in the collection or <code>null</code> if the collection is empty.
*/
public static <T extends Number> T max (Iterable<T> collection) {
T max = null;
for (T item : collection) {
@AlexRNL
AlexRNL / .bash_aliases
Created March 16, 2020 14:07
bash configuration files
#!/bin/bash
# Aliases definition file
# -----------------------
# Enable color support of ls, grep, ip, etc.
aliases_color () {
if [[ -x /usr/bin/dircolors ]] ; then
local dircolors_file=""
if [[ -r ~/.dircolors ]] ; then