Skip to content

Instantly share code, notes, and snippets.

View luvies's full-sized avatar
😤
on that mf grind

luvies

😤
on that mf grind
View GitHub Profile
@luvies
luvies / SpaceEngineers_IngameScriptBuilder.py
Created December 22, 2016 01:56
A script to convert full C# files to ones which can be used by Space Engineers.
"""
A script to edit space engineers source files to a copiable format to paste into
the programmable blocks. Whitespace and comments (both single line and multiline)
are removed (all contents inside double quoted strings are preserved), and anything
between the following comments are removed also:
/*-*/<content>/*-*/
(repeatable). This enables the automatic removal of usings and namespaces.
"""
import os
import re
/*-*/
// This file was derived from
// http://forum.keenswh.com/threads/guide-setting-up-visual-studio-for-programmable-block-scripting.7225319/
// Huge credit to them for getting the basic information I needed
/* Requires references to (<SE Install> = space engineers install)
* <SE Install>\Sandbox.Common.dll
* <SE Install>\Sandbox.Game.dll
* <SE Install>\VRage.Game.dll
* <SE Install>\VRage.Math.dll
@luvies
luvies / Remote Image Slider
Last active March 6, 2021 03:24
A JavaScript-accessible-only image slider that will slide to the next given image (after it has loaded), rather than a predetermined set. After sliding to this new image, the old one is removed, allowing you to slide any amount of images you want. You can also slide an image out or in by not providing an image location. Requires jQuery.
<!DOCTYPE html>
<!--
HTML Examples
-->
<html>
<head>
<link rel="stylesheet" href="https://rawgit.com/Gorea235/4844ce9e603d34c82b2d1253b1a71799/raw/remote-image-slider.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
@luvies
luvies / clean-drive.py
Created August 25, 2017 17:55
Removes all .DS_Store and ._* files from the current folder and all sub-folders.
#! /usr/bin/env python3
import os
import re
def get_items(dir):
dirs = []
files = []
with os.scandir(dir) as scan:
for entry in scan:
@luvies
luvies / daemon_link.py
Last active October 3, 2017 11:27
Allows for a daemon to have a separate client command to control it. The DaemonClient simply passes all arguments to the DaemonServer in place (excluding the first executable argument) and while the server is processing the arguments, the client receives all the output & send all the input.
@luvies
luvies / LiftoffManager.cs
Last active January 12, 2018 21:05
Liftoff Manager ingame script for Space Engineers
/*-*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sandbox.Common;
using Sandbox.Common.ObjectBuilders;
using Sandbox.Definitions;
using Sandbox.Engine;
@luvies
luvies / monty-hall.py
Created April 24, 2018 19:35
Python version of the Monty Hall problem
#! /usr/bin/env python3
from random import randint, shuffle
TIMES = 10_000_000
def get_dict():
return {
"wins": 0,
"losses": 0
@luvies
luvies / remote-test.csx
Created June 17, 2018 11:09
Test gist for remote dotnet-script loading
#! /usr/bin/env dotnet script -c Release
public string RemoteTest() => "Hello world";
@luvies
luvies / jake-helpers.js
Last active August 25, 2018 23:01
Some helpers to aid in Jakefiles
/**
* Provides various helpers for running a Jakefile
* Source: https://devspri.me/jake-helpers
* @module jake-helpers
*/
const { promisify } = require('util');
// create promise version of exec
jake.exec.promise = promisify(jake.exec);
#!/usr/bin/env node
'use strict';
/*
A Node.js implementation of
https://github.com/connorworley/dotfiles/blob/master/.bin/brew-autoremove
*/
const child = require('child_process');
const util = require('util');