Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lifeofchrome on github.
  • I am lifeofchrome (https://keybase.io/lifeofchrome) on keybase.
  • I have a public key ASDBFpod1I6Eha0--SM1d59E5wH2EDiIKZ8UrmjoFo9YyQo

To claim this, I am signing this object:

@lifeofchrome
lifeofchrome / ListTools.py
Created July 21, 2017 18:52
LCM and GCF tools for lists of integers
"""LCM and GCF tools for lists
Made by lifeofchrome on July 21, 2017
"""
"""lcm(numbers) takes in a list of integers and returns their least common multiple
The function loops through the minimum possible LCM and increments by 1 until the first multiple is found
test is the current test value
correct is set to correct until there's a number that isn't a multiple
"""
summon FallingSand ~ ~1 ~ {Block:redstone_block,Time:1,Passengers:[{id:FallingSand,Block:activator_rail,Time:1,Passengers:[{id:MinecartCommandBlock,Command:/scoreboard objectives add dW_timer dummy},{id:MinecartCommandBlock,Command:"/summon ArmorStand ~ ~5 ~ {NoGravity:1b,Invisible:1b,PersistenceRequired:1b,CustomName:\"destroyBlockUnder\"}"},{id:MinecartCommandBlock,Command:"/summon ArmorStand ~ ~5 ~ {NoGravity:1b,Invisible:1b,PersistenceRequired:1b,CustomName:\"dW_timer_tracker\"}"},{id:MinecartCommandBlock,Command:/scoreboard players set @e[name=dW_timer_tracker] dW_timer 400},{id:MinecartCommandBlock,Command:"/title @a title [\"\",{\"text\":\"Disentigrating World\",\"color\":\"yellow\",\"bold\":true}]"},{id:MinecartCommandBlock,Command:"/title @a subtitle [\"\",{\"text\":\"is now active\",\"color\":\"gray\",\"italic\":true}]"},{id:MinecartCommandBlock,Command:"/tellraw @a [\"\",{\"text\":\"[ 180,000 ticks elapsed / 2.5 hours ]\",\"color\":\"aqua\",\"italic\":true}]"},{id:MinecartCommandBlock,Command:setbl
@lifeofchrome
lifeofchrome / Day5.java
Created December 5, 2015 15:26
Day 5 of the Advent of Code 2015, thanks to /u/_zg_ for the Pattern code.
/**
* Created by lifeofchrome on 12/5/2015.
* Credit to /u/_zg_ for the Pattern code
*/
import java.util.regex.Pattern;
public class Day5 {
public static void main(String[] args) {
String input = "uxcplgxnkwbdwhrp\n" +
"suerykeptdsutidb\n" +
@lifeofchrome
lifeofchrome / Day4.java
Created December 4, 2015 22:02
Day 4 of the Advent of Code 2015, most of this by markwryan, thanks to him.
/**
* Created by lifeofchrome on 12/4/2015.
* Credit to markwryan for ~99% of this solution.
*/
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
public class Day4 {
static final String HASH_KEY = "hash";
@lifeofchrome
lifeofchrome / Day3.java
Created December 4, 2015 21:01
Day 3 of the Advent of Code 2015
/**
* Created by lifeofchrome on 12/3/2015.
*/
public class Day3 {
public static void main( String[] args )
{
String input = "^><^>>>^<^v<v^^vv^><<^<><<vv^<>^<^v>^vv<>v><vv^^<>>^^^v<<vv><<^>^<^v<^>^v><<<v^<v<<<v<<vv<v<^><^>><>v>v^<<v^^<^v<><^>^<<^^^>v>>v^^<v>>^>vv><v>>^>>v^>^v>^<^^v>^>^^v<v>^^<v<>>v^^v><^><^<<>v^<^<^v<v>v^>>>v^v^>^<>^v<^^vv<v>^>^<>^^<vv^<><<v<^<^^>vv<>^>v<^>^v>v^>^v<>^><>><vv<>v^v<><>v^v>>>>v^^>^><^^<v<^><^<v>>^v^v<>v<<<^<<vvvv<<v^vv^>v^^^<^^^<v>>v<^v>>>>>v<^^^^>v<^<><v>>>>><v>>v^vvvv^^<v^<>^v<^v^>v><^>^v<<>>vv^>v>v^^>vv^<^vvv<>><>><><^^^<v<>^<^^^<v><^v>>v>^v<v^vv^<>^^^>v^^^v>>^v^^<^>>^>^<<v>>>^^<>>^vv>v^<^>>>><v<><><^^v<><<<<^^<>>^<vvv^><>v<v<<<<><v<<v>v<v^><vv<v^>^<^>v^^><^v>^^>v<>^v^<>^vv^><v^^vv>vvv>v>^<vv^>>^>>^>><>>>^^^^v<vv>^<>v^^><v^>^<>v<^^v><v<<><^v><>^^^^^v^v>>^^v><<><<vv>^^^^><^>v>><<<^v>v^^>^v^<^^v>v<^<<>>^v<<<v<<>>v<^v^><vv<v^v>v^<v>><v>^v<<<vv^>v<v>>v>>v><v><v^>v^^v>^v^>>>><>^>v>^v^>>>>v^<<vv<^v><<>v<v^<^^<<v<^v^^v^>vv><vv<v^<^>><^^>^<><^^<v<><^v^v^<^^>^<v><^<
@lifeofchrome
lifeofchrome / Day2.java
Created December 4, 2015 19:10
Day 2 of the Advent of Code 2015
/**
* Created by lifeofchrome on 12/2/2015.
*/
import java.util.Scanner;
import java.lang.Math;
public class Day2 {
public static void main( String[] args)
{
int l;
int w;
@lifeofchrome
lifeofchrome / Day1.java
Created December 4, 2015 19:09
Day 1 of the Advent of Code 2015
/**
* Created by lifeofchrome on 12/1/2015.
*/
public class Day1 {
public static void main( String[] args)
{
//=======PART 1=======
String input = "(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()(
@lifeofchrome
lifeofchrome / Cmd Block Request
Created November 24, 2015 19:08
The comment was too long for YouTube, so I had to paste it here.
I'm looking for a way to target entities following number patterns or based on values on a scoreboard with respect to proximity to the nearest player.
Let me explain further. Either of these will work for me:
Option 1:
Precondition: There is at least one entity in the world besides the player.
Postcondition: A scoreboard value or custom NBT tag for entities following a specific number pattern such as Fibonacci or multiples of 5 as their ranking on proximity to the player.
Example:
For Fibonacci, the first, second, third, fifth, eighth, thirteenth, etc. closest entities to the player receive a scoreboard value or custom NBT tag.
Option 2: