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
//Usages: ssh (user@)ip(:port) -p pass | |
// * ssh -p pass (user@)ip(:port) | |
// * ssh -h|-H|-? | |
//Notice: Do NOT replace your default ssh tool with this script if you make use of Map.exe | |
// Copyright notice: I've written it, you use it however you like, giving credits would be nice, but I don't require it. | |
// If you do improve it, I would love to know about it. But that too is not required. | |
usageHint = "<b>Usage: "+program_path.split("/")[-1]+" <i>(user@)</i>[ip]<i>(:port) (-p pass)</i></b>" | |
if params.len != 1 and params.len != 3 then exit("<color=#f00>"+usageHint+"</color>") |
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
-- Copyright (c) 2020 Siasur | |
--[[ | |
This lua function allows you to splice a string (value) into another string (base) at a given location (position) without changing its length. | |
I created this function for a now scrapped project but as I spent a long time figuring out how to do it I decided to make it a public gist. | |
If you need this functionality in your script you are free to use this code as it is. | |
]] |
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 | |
if [ -f .factorio-lock ]; then | |
echo "Factorio Server is already running." | |
exit 1 | |
else | |
touch .factorio-lock | |
fi | |
screen -Dm -S factorio ./watchdog & echo $! > .factorio-lock |
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 | |
python update_factorio.py --apply-to factorio/bin/x64/factorio -x -D | |
chmod +x factorio/bin/x64/factorio |
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 void Main(string argument) | |
{ | |
var groups = new List<IMyBlockGroup>(); | |
GridTerminalSystem.GetBlockGroups(groups, selector => selector.Name.EndsWith("#Battery")); | |
foreach (var g in groups) | |
{ | |
List<IMyReactor> reactors = new List<IMyReactor>(); | |
g.GetBlocksOfType(reactors); |
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
function math.clamp(val, min, max) | |
local step = math.max(val, min) | |
return math.min(step, max) | |
end | |
local roles = { | |
{ name = "Traitor", pct = 0.25, max = 6, minply = 0}, | |
{ name = "Detective", pct = 0.17, max = 4, minply = 8}, | |
{ name = "Jackal", pct = 1, max = 1, minply = 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
public class MessageQueue<T> { | |
private static final int MAX_SIZE = 255; | |
private T[] messages; | |
private int lastReadIndex; | |
private int lastInsertIndex; | |
private int adjustIndex(int index) { | |
if (index >= MAX_SIZE) { |
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
-- Hex2Color Converter | |
-- Copyright (c) 2016 Mischa Behrend <https://github.com/siasur> | |
--[[ | |
Dieses kleine Codesnippet konvertiert (erweiterte) Hexadezimalfarben in ihre entsprechenden RGBA Werte. | |
Erweitert bedeutet, dass die Hexadezimalwerte (vom Standard abweichend) um eine weitere Stelle für den | |
Alphakanal ergänzt werden dürfen. Die führende Raute kann bei bedarf weggelassen werden. | |
This little codesnippet will convert (extended) hexadecimal colors to its RGBA counterpart. Extended | |
means that you can (different to the default) append a fourth value for the alpha channel. |
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 class TsBotBootstrapper { | |
public static final TS3Config config; | |
public static TS3Query query; | |
public static TS3Api api; | |
public static TS3Listener listener; | |
public static void main(String[] args) { | |
config = new Ts3Config(); | |
config.setHost("127.0.0.1"); |
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
local function Mul( --[[number]] _x, --[[number]] _y ) | |
local result = 0 | |
while ( _x >= 1 ) do | |
if ( _x%2 ~= 0 ) then | |
result = result + _y | |
end | |
_x = math.floor( _x / 2 ) | |
_y = _y * 2 | |
end | |
return result |