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
def add_warning_minecraft(target_name, message, admin_note, admin_id) | |
pin = Random.rand(9).to_s + Random.rand(9).to_s + Random.rand(9).to_s + Random.rand(9).to_s | |
while has_warning?(pin) do | |
pin = Random.rand(9).to_s + Random.rand(9).to_s + Random.rand(9).to_s + Random.rand(9).to_s | |
end | |
@sql_client.query("INSERT INTO warnings (id, target, aid, message, adminnote, sendtime, acktime, ack, pin, type) | |
VALUES (null, '#{@sql_client.escape(target_name)}', '#{admin_id}', '#{@sql_client.escape(message)}', '#{@sql_client.escape(admin_note)}', | |
'#{Time.now.to_i}', 0, 0, '#{pin}', 'mc')") |
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
public int generateValidPinCode(String seed) { | |
int pin = 0; | |
Random r = new Random(System.nanoTime() + seed.hashCode()); | |
int randombit = r.nextInt(9) * 1000 + r.nextInt(999); | |
ResultSet results = sqlDatabase.executeQuery("SELECT * FROM warnings WHERE pin=?", randombit); | |
try { | |
if (results.next()) { | |
pin = generateValidPinCode(Integer.toString(randombit)); | |
} else { |
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
var express = require('express'); | |
var app = express(); | |
var http = require('http'); | |
var redis = require('redis'); | |
var async = require('async'); | |
var redis_client = redis.createClient(6379, "localhost"); | |
//var redis_client = redis.createClient(port, host, options) | |
var eventId = 0; | |
app.listen(3000); |
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
//http://code.google.com/p/ihackedgmod/ | |
//http://creativecommons.org/licenses/by-sa/3.0/ | |
#include <sourcemod> | |
#include <sdktools> | |
#include <colors> | |
public Plugin:myinfo = | |
{ | |
name = "Build Mode", | |
author = "nicatronTg", |
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 | |
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" | |
let secs=$((${upSeconds}%60)) | |
let mins=$((${upSeconds}/60%60)) | |
let hours=$((${upSeconds}/3600%24)) | |
let days=$((${upSeconds}/86400)) | |
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"` | |
# get the load averages | |
read one five fifteen rest < /proc/loadavg |
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
ItemStack i = new ItemStack(Material.WRITTEN_BOOK); | |
ItemFactory itemFactory = plugin.getServer().getItemFactory(); | |
BookMeta bookMeta = (BookMeta) itemFactory.getItemMeta(Material.WRITTEN_BOOK); | |
i.setItemMeta(bookMeta); |
NewerOlder