Skip to content

Instantly share code, notes, and snippets.

View TuxCoding's full-sized avatar

Alex (TuxCoding) TuxCoding

  • [::1]
View GitHub Profile
@TuxCoding
TuxCoding / operations.pl
Created January 29, 2017 10:21
Some Prolog operations re-coded for learning purpose
sumElement([], 0).
sumElement([Head|Tail], Max):- sumElement(Tail, Temp), Max is Temp + Head.
deleteElement(Element, [Head|Tail], Tail).
deleteElement(Element, [Head|Tail], [Head|Neu]):- deleteElement(Element, Tail, Neu).
sumLst(X, Y, S):- S is X +Y.
maxE(X, Y, Max):- X > Y, Max is X.
maxE(X, Y, Max):- Y > X, Max is Y.
@TuxCoding
TuxCoding / compile-latex.sh
Last active January 30, 2017 16:22
Move compiled LaTeX files outside the workspace folder
# Source: http://tex.stackexchange.com/a/11125
# .pdf and .synctex.gz will still keep in that folder
# *nix based LaTeX installations
pdflatex -output-directory=folder <file>
# windows based LaTeX installations
pdflatex --aux-directory=folder <file>
@TuxCoding
TuxCoding / file-size.java
Created January 26, 2017 09:05
Get the amount of free or total bytes on file system using the Java 7 NIO API
long freeSpace = 0;
long totalSpace = 0;
try {
FileStore fileStore = Files.getFileStore(Paths.get("."));
freeSpace = fileStore.getUsableSpace();
totalSpace = fileStore.getUsableSpace();
} catch (IOException ioEx) {
Logger.getGlobal().log(Level.WARNING, "Cannot calculate free/total disk space", ioEx);
}
@TuxCoding
TuxCoding / seafile-ignore.txt
Last active January 29, 2017 09:38
Seafile ignore for latex projects
*.aux
*.bbl
*.blg
*.log
*.out
*.pdf
*.toc
*.idx
*.dvi
*.lof
@TuxCoding
TuxCoding / bukkit-update-template.html
Created January 6, 2017 20:52
Bukkit update template for the updated dev bukkit site
<h3>Changelog for VERSION</h3>
<h6><span style="color: #008000;"><strong>Added</strong></span></h6>
<ul>
<li>stuff</li>
</ul>
<h6><strong><span style="color: #ff9900;">Changed/Fixed</span></strong></h6>
<ul>
<li>stuff</li>
@TuxCoding
TuxCoding / line-of-sight.php
Created January 4, 2017 09:50
Line of sight Freifunk visualizer for viewing possible links - Original author @ropg - Source: https://wiki.freifunk.net/Berlin:Line-of-Sight_visualiser
<?php
define ('SPEED_OF_LIGHT', 299792458); // in m/s
define ('CIRCUMFERENCE_OF_EARTH', 40075000); // in m
$cachefile = 'cached_locations';
// If the cache file exists and it is younger than 12 hrs and 'flush' get var is is not set ...
if (file_exists($cachefile)) {
if (time() - filectime($cachefile) < 12 * 3600 && !isset($_GET['flush'])) {
@TuxCoding
TuxCoding / download-rec.sh
Created December 31, 2016 16:02
Download files from a web server recursively if that server enabled directory indexing
# -r recursive
# -nH don't create host directories.
# -nd don't create directories.
# -e robots=off
wget --no-parent -nH -r -e robots=off TARGET
@TuxCoding
TuxCoding / upgrade.sh
Last active August 8, 2017 15:18
Some package manager update all scripts
# apt
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
# pacman
pacman -Syu
# zypper
zypper refresh
@TuxCoding
TuxCoding / start-server.bat
Created December 16, 2016 15:17
Starts a Minecraft server in a loop with debug options enabled
:A
@ECHO OFF
java -Xmx3G -server -Xdebug -XX:+UnlockDiagnosticVMOptions -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n -jar paperclip.jar
pause
goto A:
@TuxCoding
TuxCoding / start-server.sh
Created December 16, 2016 15:14
Starts a Minecraft server in a loop with debug options enabled
while true;
do
java -Xmx3G -server -Xdebug -XX:+UnlockDiagnosticVMOptions -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n -jar paperclip.jar
read -rsp $'Press any key to continue...\n' -n 1 key
done