Skip to content

Instantly share code, notes, and snippets.

#include "cbase.h"
#include "hud.h"
#include "hud_hp_analog.h"
#include "iclientmode.h"
#include "hud_macros.h"
#include "vgui_controls/controls.h"
#include "vgui/ISurface.h"
#include "tier0/memdbgon.h"
#include <vgui/ILocalize.h>
@Wolf480pl
Wolf480pl / mvn-run
Created May 15, 2014 19:03
a script to run a Java class as an application with a classpath from a maven project
#!/bin/sh
java -cp target/classes:`mvn -o dependency:build-classpath |sed s/\\\\[INFO.*// |tr -d " \\n"` "$@"

Keybase proof

I hereby claim:

  • I am Wolf480pl on github.
  • I am wolf480pl (https://keybase.io/wolf480pl) on keybase.
  • I have a public key whose fingerprint is E4C2 E023 3845 4C51 B7E8 A340 73C0 4340 D233 5052

To claim this, I am signing this object:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I hereby claim:

  • I am Wolf480pl on GitHub.
  • I have an OpenPGP public key whose fingerprint is E4C2 E023 3845 4C51 B7E8 A340 73C0 4340 D233 5052
#!/usr/bin/env python2
# Copyright (c) 2014 Wolf480pl <wolf480@interia.pl>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@Wolf480pl
Wolf480pl / constant-case.sh
Last active August 29, 2015 14:06
Fun bash pipelines
# Changes names of all "public static int" fields in a java source file from camelCase to CONSTANT_CASE.
grep "public static int" IRCNumerics.java |sed -r 's/ *public static int ([a-zA-Z]+) = .*/\1 \1/' |awk '{$2=gensub(/([a-z])([A-Z])/,"\\1_\\2","g",$2); $2=toupper($2); printf("s/%s([^(])/%s\\1/\n", $1, $2);}' > sed.txt
# It's a good idea to look at the sed.txt file now and see if it's sane.
sed -r -f sed1.txt IRCNumerics.java > IRCNumerics1.java
# Now you have a chance to review IRCNumerics1.java, before you replace IRCNumerics.java with it.
# If the fields are used in any other files, you can just do
sed -r -f sed1.txt SomeClass.java > SomeClass1.java
# for each of them (then review and replace the original file with the new one)
@Wolf480pl
Wolf480pl / u64-vs-u71.md
Last active August 29, 2015 14:08
OpenJDK 7u65 vs 7u71

Below is a diff between OpenJDK 7u65 and 7u71 sources downloaded by IcedTea build scripts (IcedTea 2.5.2 and 2.5.3 respectively).

As far as I know, a few security issues were fixed between these two java versions.

OpenJDK sources are licensed under GPLv2 with the Classpath Exception and the OpenJDK Assembly Exception, see http://openjdk.java.net/legal/

@Wolf480pl
Wolf480pl / stop.sh
Last active August 29, 2015 14:08
A little script if you need a process to exist before it starts running
#!/bin/sh
# Usage:
# stop.sh <program> <args...>
# And then when you want the program to start running
# kill -CONT <pid>
kill -STOP $$
exec "$@"
#!/bin/sh
echo -e \\e[0m normal
echo -e \\e[1m bold\\e[0m
echo -e \\e[2m faint\\e[0m
echo -e \\e[3m italic\\e[0m
echo -e \\e[4m underline\\e[0m
echo -e \\e[5m blink slow\\e[0m
echo -e \\e[6m blink fast\\e[0m
echo -e \\e[7m negative\\e[0m
@Wolf480pl
Wolf480pl / gist.sh
Last active August 29, 2015 14:12
A wrapper around https://github.com/defunkt/gist to allow downloading gists too. For multi-file gists it will only get the first file. Requires curl. Best served with `alias gist=gist.sh`
#!/bin/sh
# Usage: gist.sh -r <url>
if [ "$1" == "-r" ]; then
exec curl -L "$2".txt
else
exec gist "$@"
fi