Skip to content

Instantly share code, notes, and snippets.

View JBou's full-sized avatar

Gabriel Patzleiner JBou

View GitHub Profile
@gruber
gruber / Liberal Regex Pattern for All URLs
Last active March 20, 2024 20:28
Liberal, Accurate Regex Pattern for Matching All URLs
The regex patterns in this gist are intended to match any URLs,
including "mailto:foo@example.com", "x-whatever://foo", etc. For a
pattern that attempts only to match web URLs (http, https), see:
https://gist.github.com/gruber/8891611
# Single-line version of pattern:
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))
@kylef
kylef / sabnzbd.py
Created January 11, 2010 15:04
SABnzbd python api
import urllib, json
class SABnzbd(object):
"""
Usage:
>>> from sabnzbd import SABnzbd
>>> s = SABnzbd('sakar.local', 8080, '4488f2881b90d7753bef8fb9e1bc56b3')
>>> s.pause() # Pauses the downloads
>>> s.shutdown() # Shut's down SABnzbd+
"""
@michail-nikolaev
michail-nikolaev / gist:3840973
Created October 5, 2012 16:55
JPA - Tree structure with automatic order and tested operations for it
@Entity
public class TreeCategory extends IdentifiableEntity {
....
@ManyToOne(optional = true)
@JoinColumn(name = "parent_id", referencedColumnName = "id")
public TreeCategory getParent() {
return parent;
}
@fanzeyi
fanzeyi / scroll.css
Created November 1, 2012 18:34
Google Plus Scroll Style
::-webkit-scrollbar{
height:16px;
overflow:visible;
width:16px;
}
::-webkit-scrollbar-button{
height:0;
width:0;
}
@zach-klippenstein
zach-klippenstein / ChangePassword.java
Last active March 20, 2024 05:16
The keystore password on Java keystore files is utterly pointless. You can reset it without knowing it, as shown by this code. Note that private keys are still secure, as far as I know. The JKS implementation is copyright Casey Marshall (rsdio@metastatic.org), and the original source is available at http://metastatic.org/source/JKS.java. I've in…
import java.util.*;
import java.io.*;
import java.security.*;
public class ChangePassword
{
private final static JKS j = new JKS();
public static void main(String[] args) throws Exception
{
@DarkBlade12
DarkBlade12 / ParticleEffect.java
Last active December 23, 2023 16:20
This is a little library which allows you to display all possible particle effects in Minecraft with your plugin.
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
@PaulBGD
PaulBGD / FuzzySearch.java
Last active December 20, 2015 22:09
Simple Fuzzy Search
public String findMatch(String arg, List<String> words, boolean ignoreRepeat) {
// Where the final word will be stored.
String word = null;
/*
* Sometimes two words will equally match (rarely). If we find one that matches, we
* increase this by one. Just in case the person wants it to return null, we have the
* ignoreRepeat.
*/
int repeated = 0;
@leMaik
leMaik / CryptedTextAnimation.cs
Last active December 29, 2015 04:59
A tiny class to make strange crypted animated text as you know it from Minecraft. Sounds useless? It is useless! :D
using System;
using System.Text;
using System.Windows;
using System.Windows.Media.Animation;
namespace leMaik.Animations {
class CryptedTextAnimation : AnimationTimeline {
static CryptedTextAnimation() {
LengthProperty = DependencyProperty.Register("Length", typeof(int), typeof(CryptedTextAnimation));
}
@mcardy
mcardy / Bukkit Annotation Commands
Last active January 1, 2016 07:49 — forked from arxenix/Bukkit Annotation Commands
Fixed access modifiers allowing for @command and @completer to be used outside of just that package
package net.minezrc.framework.test;
import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.command.*;
import org.bukkit.entity.Player;
import org.bukkit.help.GenericCommandHelpTopic;
import org.bukkit.help.HelpTopic;
import org.bukkit.help.HelpTopicComparator;
import org.bukkit.help.IndexHelpTopic;
@DarkBlade12
DarkBlade12 / ReflectionUtils.java
Last active August 8, 2019 23:49
These are utils which make dealing with reflection much easier.
package com.darkblade12.particledemo.particle;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;