Skip to content

Instantly share code, notes, and snippets.

View Sidneys1's full-sized avatar
🐇
Knock knock, Neo...

Sidneys1 Sidneys1

🐇
Knock knock, Neo...
View GitHub Profile

Syntax

All target selectors start with @. The following character is the selector type. For example, @p means 'closest player'.

Target selectors may have additional, optional arguments. You can specify these in [ ], using the syntax a=0. For example, @p[a=0,b=5,c=-500].

There is a special short syntax for just specifying x, y, z and r arguments; simply list their values separated by a comma, without x=. For example: @p[100,64,-100,5] for 5 range, x=100, y=64 and z=-100. Each of these are optional and skippable by leaving them empty. For example, to just specify y coordinate: @p[,64].

Global Arguments:

(Case sensitive)

  • x - X coordinate for search center. Default is senders coordinate, or 0.
@Sidneys1
Sidneys1 / Update-Git.ps1
Last active February 23, 2016 16:07
Point at a root directory and run `Update-Git`. Will recursively search subdirectories and fetch/pull all branches that don't start with `local`
function Write-Color($string,[switch]$nonewline) {
# Reference:
# 0 = Black
# 1 = DarkBlue
# 2 = DarkGreen
# 3 = DarkCyan
# 4 = DarkRed
# 5 = DarkMagenta
# 6 = DarkYellow
# 7 = Gray
@Sidneys1
Sidneys1 / Win10PrefechDecompress.cs
Created June 14, 2016 11:13 — forked from EricZimmerman/Win10PrefechDecompress.cs
pinvoke for RtlDecompressBufferEx in c#
using System.Runtime.InteropServices;
namespace Prefetch.XpressStream
{
public class Xpress2
{
// const ushort COMPRESSION_FORMAT_LZNT1 = 2;
// const ushort COMPRESSION_FORMAT_XPRESS = 3;
const ushort CompressionFormatXpressHuff = 4;
@Sidneys1
Sidneys1 / screenfetch.ps1
Created August 20, 2016 14:12
'screenfetch'-like logo for powershell
function Get-Uptime() {
$lastboottime = (Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime
$sysuptime = (Get-Date) - [System.Management.ManagementDateTimeconverter]::ToDateTime($lastboottime)
if ($sysuptime.days -eq 1) { Write-Host -NoNewline $sysuptime.days "day " }
if ($sysuptime.days -gt 1) { Write-Host -NoNewline $sysuptime.days "days " }
if ($sysuptime.hours -eq 1) { Write-Host -NoNewline $sysuptime.hours "hour " }
if ($sysuptime.hours -gt 1) { Write-Host -NoNewline $sysuptime.hours "hours " }
if ($sysuptime.minutes -eq 1) { Write-Host -NoNewline $sysuptime.minutes "minute " }
if ($sysuptime.minutes -gt 1) { Write-Host -NoNewline $sysuptime.minutes "minutes " }
if ($sysuptime.seconds -eq 1) { Write-Host -NoNewline $sysuptime.seconds "second " }
@Sidneys1
Sidneys1 / SumIt.cs
Created August 23, 2016 23:16
SumIt
using System;
using System.Collections.Generic;
using System.Linq;
namespace SumIt {
internal static class Program {
private static void Main() {
var nums = new List<string[]> { new[] { "+-1", "+1" } };
for (var i = 2; i < 10; i++)
@Sidneys1
Sidneys1 / StaticInterfaceTest.cs
Created September 22, 2016 00:47
Benchmarking a Static Interface workaround using structs
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace StaticInterfaceTest {
public interface IInterface {
int Run();
}
@Sidneys1
Sidneys1 / InterruptableReadline.cs
Created October 27, 2016 12:33
A ReadLine wrapper that allows cancellable and timeoutable Console.ReadLine calls
internal static class InterruptableReadline {
private static readonly AutoResetEvent StartReading = new AutoResetEvent(false);
private static readonly AutoResetEvent DoneReading = new AutoResetEvent(false);
private static readonly Thread ReadThread = new Thread(ReadThreadMain) { IsBackground = true };
private static string _readVal;
private static bool _cancelled;
static InterruptableReadline() { ReadThread.Start(); }
public static void Shutdown() { ReadThread.Abort(); }
@Sidneys1
Sidneys1 / json_object.py
Created October 8, 2019 14:51
Python JsonObject
"""Helper for json-based objects"""
from inspect import isclass
from typing import get_type_hints, Union, TypeVar, Type
# cSpell:ignore isclass
def patch_target(target, patch):
if not isinstance(patch, dict):
@Sidneys1
Sidneys1 / stail.sh
Created January 26, 2023 20:00
Short-Tail
#!/usr/bin/env bash
HELP="Usage: $0 [-n LINES] [-p PREFIX] [-w] [-h]
Continuously displays the last '-n' lines of 'stdin'.
Parameters:
-n Number of lines to display (default: 5).
-p PREFIX Prefix lines with 'PREFIX'.
-w Preserve blank lines (default: false).
-h Display this help
@Sidneys1
Sidneys1 / get-reclaimed-hardlink-space.sh
Created May 24, 2023 20:24
Calculate space savings from deduplication with hardlinks (a la `jdupes -L` or `hardlink`)