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
import subprocess | |
def active_window_name(): | |
window_id_cmd = ["/usr/bin/xprop", "-root", "_NET_ACTIVE_WINDOW"] | |
window_id = subprocess.check_output(window_id_cmd).decode("utf-8").strip().split()[-1] | |
window_name_cmd = ["/usr/bin/xprop", "-id", window_id, "_NET_WM_NAME"] | |
window_name = subprocess.check_output(window_name_cmd).decode("utf-8").strip()[29:-1] | |
return window_name | |
print(active_window_name()) |
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
#!/usr/bin/env python3 | |
import random | |
with open("heroes.txt", "r") as f: | |
heroes = f.read().splitlines() | |
draft = random.sample(heroes, 3) | |
print(*draft, sep=", ") |
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
#!/usr/bin/env python3 | |
import os | |
import sys | |
from shutil import copy2 | |
from pathlib import Path | |
if len(sys.argv) != 2: | |
raise Exception("Invalid number of arguments. One directory path must be provided.") | |
p = Path(sys.argv[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
#!/usr/bin/env bash | |
pep8 --exclude=venv . |
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
game.take_screenshot{resolution={2500,2500}, zoom=0.290, path="screenshot_"..game.local_player.surface.map_gen_settings.seed.."_"..game.tick..".png", show_gui=false, show_entity_info=true} |
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
game.player.print("Getting player position...") | |
local player_position = game.player.position | |
game.player.print(string.format("Player is at x=%.3f, y=%.3f", player_position.x, player_position.y)) | |
game.player.print("Checking for neighbouring water tiles...") | |
local neighbouring_water_tiles = {} | |
for x=player_position.x-1,player_position.x+1 do | |
for y=player_position.y-1,player_position.y+1 do | |
local t = game.player.surface.get_tile(x,y) | |
if t.name == "water" or t.name == "deepwater" then |
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
colours = ["#5DA5DA", "#FAA43A", "#60BD68", "#B276B2", "#DECF3F", "#F15854"] |
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
c:\Windows\System32\certutil.exe -hashfile c:\full\path\to\file [HASH_ALGORITHM] | |
Supported HASH_ALGORITHMs are: MD2, MD4, MD5, SHA1, SHA256, SHA384, SHA512 |
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
import random | |
import statistics | |
import sys | |
def d(x): | |
return random.randint(1, x) | |
def droplow_4d6(): | |
dice = [d(6), d(6), d(6), d(6)] | |
dice.sort() |
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
import collections | |
import itertools | |
import random | |
from csv import DictReader | |
from pathlib import Path | |
gems_csv= Path("./gems.csv") | |
Gem = collections.namedtuple("Gem", "name value") | |
GemCategory = collections.namedtuple("GemCategory", "weight diev dievmult avgv gems") |
OlderNewer