Skip to content

Instantly share code, notes, and snippets.

View hakusaro's full-sized avatar

Lucas Nicodemus hakusaro

View GitHub Profile
@hakusaro
hakusaro / shared.lua
Created May 2, 2012 06:59
Lua cluster grenade (Tribes: Ascend style)
if SERVER then
AddCSLuaFile ("shared.lua")
SWEP.Weight = 5
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = true
elseif CLIENT then
SWEP.PrintName = "Cluster Grenade"
SWEP.Slot = 5
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
@hakusaro
hakusaro / gist:4489265
Created January 9, 2013 00:04
ItemMeta usage in Bukkit
ItemStack i = new ItemStack(Material.WRITTEN_BOOK);
ItemFactory itemFactory = plugin.getServer().getItemFactory();
BookMeta bookMeta = (BookMeta) itemFactory.getItemMeta(Material.WRITTEN_BOOK);
i.setItemMeta(bookMeta);
@hakusaro
hakusaro / .bash_profile
Last active June 16, 2023 17:43 — forked from MichalPekala/.bash_profile
My Raspberry Pi's .bash_profile. Differences from original are purely aesthetic - no need for weather, and I like things to be lined up nicely when I ssh into my RPi.
#!/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
@hakusaro
hakusaro / buildmode.cpp
Created May 19, 2013 02:12
Not actually C++, it's SourcePawn.
//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",
@hakusaro
hakusaro / app.js
Created July 12, 2013 22:57
Rust kill tracker thing
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);
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 {
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')")
@hakusaro
hakusaro / conversation-with-tapi.txt
Created October 12, 2013 16:15
This is the conversation that happened with two tAPI developers and me regarding the openness of the server and the client.
8:25:23 AM → Shockah joined ⇐ Diablodoc quit
9:18:47 AM <Shockah> geh, nicatronTg
9:18:51 AM <Shockah> seriously
9:18:58 AM <Shockah> i already said we can't do that with the server source
9:18:59 AM <~nicatronTg> Morning Shockah
9:19:04 AM <~nicatronTg> How?
9:19:08 AM <Shockah> but i guess you were afk
9:19:13 AM <Shockah> like 4 hours ago
9:19:27 AM <~nicatronTg> Shockah: unless you highlight someone in irc, they won't see your messages
9:19:28 AM <Shockah> the thing is, we DON'T HAVE AN ACTUAL SERVER.

Keybase proof

I hereby claim:

  • I am nicatronTg on github.
  • I am xn (https://keybase.io/xn) on keybase.
  • I have a public key whose fingerprint is DBBC 74A2 4E03 47B3 0602 B456 83A5 8D80 0459 0319

To claim this, I am signing this object:

soccerkidguy
darkphantom66
Sdc97
nicatronTg
_Smoopy_
samrg472
towerladder
varagoth
LegomanTyler
WulfyStylez