Skip to content

Instantly share code, notes, and snippets.

View games647's full-sized avatar

games647 games647

View GitHub Profile
@games647
games647 / start.sh
Created August 10, 2016 08:41
Java remote debugging startup
java -Xdebug -XX:+UnlockDiagnosticVMOptions -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n -jar fileName.jar
@games647
games647 / find-duplicates.sql
Last active August 26, 2016 11:51
Find duplicates in SQL if COLUMN or COLUM, COLUM has the same values. Just replace TABLE and COLUMN with your setup.
SELECT
COLUMN, COUNT(*)
FROM
TABLE
GROUP BY
COLUMN
HAVING
COUNT(*) > 1
@games647
games647 / golang-cross-compile.sh
Last active August 26, 2016 11:51
Cross compile command syntax
GOOS=windows GOARCH=386 go build -o hello.exe hello.go
#Supported architecture: https://golang.org/doc/install/source#environment
#!/usr/bin/python3
from pysimplesoap.client import SoapClient
location = 'http://fritz.box:49000/igdupnp/control/WANCommonIFC1'
namespace = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1'
action = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1#'
debug = False # display http/soap requests and responses
client = SoapClient(location, action, namespace, trace=debug)
@games647
games647 / Spigot-update-template.txt
Created September 20, 2016 10:45
Spigot update template. Using BB-Code because it's copyable into a .txt file. Replace all VERSION tags
[B][SIZE=5][COLOR=rgb(0, 89, 179)]VERSION[/COLOR][/SIZE][/B]
[SIZE=4][B][COLOR=rgb(0, 179, 0)][U]Added[/U][/COLOR][/B][/SIZE]
[LIST]
[*]
[/LIST]
[B][U]Changes/Fixes[/U][/B]
[LIST]
[*]
@games647
games647 / devBukkit-update-template.txt
Created September 20, 2016 10:47
https://dev.bukkit.org/ update template. Replace all VERSION tags
=== Changelog VERSION ===
====== ++Added++ ======
*
====== Changed/Fixed ======
*
@games647
games647 / minecraft-ping.java
Created September 22, 2016 11:42
Get the minecraft ping of a Player object in a Bukkit/MCPC server
public class MinecraftPing {
//this value updates every 40 Ticks => 2 Seconds. So you proparly want to add a scheduled task for it.
public int getReflectionPing(Player player) {
try {
if (getHandleMethod == null) {
getHandleMethod = player.getClass().getDeclaredMethod("getHandle");
//disable java security check. This will speed it a little
getHandleMethod.setAccessible(true);
}
@games647
games647 / scan.sh
Created October 15, 2016 09:46
Scans the network for mac adresses
nmap -sP -n 192.168.0.0/24
@games647
games647 / area-of-ring.rkt
Created October 18, 2016 17:36
First Racket program to calculate the content size of a ring
;; area-of-ring: number number -> number
;; Determines the area of a ring
;; with outer radius outer and an inner radius inner
;; Example: (area-of-ring 5 3) is
;; roughly 50.26544
(define (area-of-ring outer inner)
(- (area-of-circle outer)
(area-of-circle inner)))
;;Tests
@games647
games647 / int_to_binary.py
Created November 6, 2016 10:54
Converts an integer to a binary with two_complement and unsigned representation
#! /usr/bin/python3
# Example output:
# Enter a number:1024
# Number: 1024
# Needed bits: 11
# Bytes (unsigned) 100 0000 0000
# Bytes (two-complement) 0100 0000 0000