This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.IOException; | |
import java.io.RandomAccessFile; | |
import java.nio.channels.FileLock; | |
import java.nio.channels.OverlappingFileLockException; | |
import static com.google.common.base.Preconditions.checkNotNull; | |
public class FileSystemLock { | |
private final File lockFile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
""" Cleaning script based on .gitignore file, the 'find' and 'rm' command. | |
It removes files with .gitignore pattern. | |
This script reads the .gitignore file, parses the patterns found there to a | |
shell remove command and then executes it. | |
- With the 'dirs' option it also removes directories. | |
- With the 'debug' option it just prints the command it would execute and exits. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Pre-commit hook that crushes PNG files in order to reduce their size. | |
if ! which -s pngcrush | |
then | |
echo "Please install pngcrush to reduce png images size before commit" | |
exit 1; | |
fi | |
for file in `git diff --cached --name-only | grep ".png\$"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef mvn | |
_mvn_targets () { | |
local -a commands | |
commands=('jetty\:run:Run Jetty from the current context.' 'validate:validate the project is correct and all necessary information is available' 'compile:compile the source code of the project' 'test:test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed' 'package:take the compiled code and package it in its distributable format, such as a JAR.' 'integration-test:process and deploy the package if necessary into an environment where integration tests can be run' 'verify:run any checks to verify the package is valid and meets quality criteria' 'install:install the package into the local repository, for use as a dependency in other projects locally' 'deploy:done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.' 'clean:remove all files generated by the previous build') | |
_describe -t commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Newbie programmer | |
int factorial_newbie(int n) { | |
if (n == 0) { | |
return 1 | |
} else { | |
return n * factorial_newbie(n - 1) | |
} | |
} | |
println factorial_newbie(6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.instrument.Instrumentation; | |
import java.lang.reflect.Array; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.Modifier; | |
import java.security.AccessController; | |
import java.security.PrivilegedAction; | |
import java.util.IdentityHashMap; | |
public class ObjectSizer { | |
private static Instrumentation instrumentation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import sun.jvm.hotspot.debugger.*; | |
import sun.jvm.hotspot.memory.*; | |
import sun.jvm.hotspot.oops.*; | |
import sun.jvm.hotspot.runtime.*; | |
import sun.jvm.hotspot.tools.*; | |
import sun.jvm.hotspot.utilities.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
JDGUI_BIN=$1; FILE_PATH=$2 | |
DELIMITER_INDEX=$(awk -v a="$FILE_PATH" -v b="!/" 'BEGIN{print index(a,b)}') | |
if [ $DELIMITER_INDEX -eq 0 ]; then | |
$JDGUI_BIN $FILE_PATH | |
else | |
JAR_FILE=${FILE_PATH:0:$DELIMITER_INDEX-1} | |
CLASS_RELATIVE_LOCATION=${FILE_PATH:$DELIMITER_INDEX+1} | |
if [[ $CLASS_RELATIVE_LOCATION == "" ]]; then | |
$JDGUI_BIN $JAR_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0'?> | |
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> | |
<!-- http://ubuntuforums.org/showthread.php?t=1354116 --> | |
<fontconfig> | |
<!-- See: man 5 fonts-conf --> | |
<!-- Antialias rules --> | |
<match target="font"> | |
<!--Subpixel smoothing: rgb, bgr, vrgb, vbgr, none--> | |
<edit mode="assign" name="rgba"><const>none</const></edit> |
OlderNewer