Skip to content

Instantly share code, notes, and snippets.

@tonybruess
tonybruess / Skin.php
Last active Jun 8, 2020
avatar.oc.tc
View Skin.php
<?php
class Skin {
public static function get($username) {
$steve = in_array(strtolower($username), array("steve", "player", "default"));
if(!$steve) $contents = self::fetch('http://skins.minecraft.net/MinecraftSkins/' . $username . '.png');
$defaultImage = WideImage::load("char.png");
$defaultType = "image/png";
if ($steve || $contents === false) {
$img = $defaultImage;
View A.java
public class A {
protected static final A instance = new A();
public static A getInstance() {
return instance;
}
}
@tonybruess
tonybruess / resume.sh
Last active Dec 19, 2017
Resume all screen sessions
View resume.sh
IFS=$'\n'
for line in $(screen -ls | head -n -2 | sed 1d); do
screen -r `echo $line | cut -f2`;
done
@tonybruess
tonybruess / gist:9405134
Created Mar 7, 2014
Username limitations for various services
View gist:9405134
Skype
Min: 6
Max: 32
Can contain: a-z A-Z 0-9 . , _ -
Other: Must start with a letter
Twitter
Min: 1
Max: 15
Can contain: a-z A-Z 0-9 _
View mongobackup.pp
class overcast::mongobackup {
file { '/root/mongo-backup':
source => 'puppet:///modules/overcast/mongo-backup',
mode => 0755,
}
cron { 'daily mongo backup':
command => '/root/mongo-backup',
user => 'root',
hour => 4,
@tonybruess
tonybruess / README.md
Last active Nov 10, 2019
Upgrade e1000e drivers
View README.md

Upgrade e1000e drivers on Ubuntu

Simply run ./upgrade.sh.

Information

Make sure to run shutdown -r now after completing installation.

Also, use lshw -C network to verify the driver installation.

If the driver is still outdated after reboot, make sure /etc/modules contains e1000e.

@tonybruess
tonybruess / log4j2.xml
Last active Aug 29, 2015
Overcast's custom log4j2 config
View log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="net.minecraft,com.mojang.util">
<Appenders>
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
<Queue name="TerminalConsole">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n"/>
</Queue>
<RollingRandomAccessFile name="Server" fileName="/minecraft/logs/alpha/server.log" filePattern="/minecraft/logs/alpha/server-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n"/>
<Policies>
@tonybruess
tonybruess / chat_color.rb
Created Jun 29, 2014
Bukkit's ChatColor implementation in ruby
View chat_color.rb
class ChatColor
@@color_char = "\u00A7"
def initialize(code)
@code = code
end
def +(str)
to_str + str
end
@tonybruess
tonybruess / jdom2.md
Created Jun 30, 2014
How to add jdom2 to a maven repo
View jdom2.md

jdom

There's a fun dependency called jdom2. It is currenty located in our repository. If it ever gets removed, this is how you readd it.

mvn deploy:deploy-file -Dfile=jdom-2.0.5-contrib.jar -DgroupId=org.jdom -DartifactId=jdom2-contrib -Dversion=2.0.5 -Dpackaging=jar -DrepositoryId=overcast-deployment -Durl=https://repo.oc.tc/content/repositories/releases

mvn deploy:deploy-file -Dfile=jdom-2.0.5.jar -DgroupId=org.jdom -DartifactId=jdom2 -Dversion=2.0.5 -Dpackaging=jar -DrepositoryId=overcast-deployment -Durl=https://repo.oc.tc/content/repositories/releases
View gist:a53219b066e8e0216487
[09:41:22] Dinnerbone: For those who care about it: there are new public API routes for name changes
[09:41:38] Dinnerbone: https://api.mojang.com/users/profiles/minecraft/KrisJelbring will lookup single name -> uuid
[09:42:04] Dinnerbone: https://api.mojang.com/users/profiles/minecraft/KrisJelbring?at=1405612800 will lookup single name -> uuid as of a certain timestamp
[09:42:14] Dinnerbone: (So even if he changes his name now, that link will return him)
[09:42:46] Dinnerbone: https://api.mojang.com/user/profiles/7125ba8b1c864508b92bb5c042ccfe2b/names will show you all the names a profile has been known by
[09:43:01] Dinnerbone: This concludes the public service announcement.