This file contains hidden or 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
/* | |
[dependencies] | |
rand = "0.8" | |
*/ | |
use rand::seq::SliceRandom; | |
use rand::thread_rng; | |
use std::collections::HashMap; | |
fn main() { | |
let w: i16 = 8; |
This file contains hidden or 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
from random import shuffle | |
W = 8 | |
H = 8 | |
B = 10 | |
A = W * H | |
S = A - B | |
line = [1] * B + [0] * S | |
shuffle(line) | |
checkidxs = [ | |
[chk for chk in [ |
This file contains hidden or 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
from typing import Protocol | |
class IFoo(Protocol): | |
value: int | |
class Foo: | |
_value: int | |
@property | |
def value(self) -> int: |
This file contains hidden or 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
class SomeClassToMock(object): | |
def __init__(self, key=None): | |
self.key = key | |
old_new, SomeClassToMock.__new__ = SomeClassToMock.__new__, lambda: None | |
SomeClassToMock.__new__ = old_new | |
SomeClassToMock(key='value') |
This file contains hidden or 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
def match_value(number: int) -> str: | |
three = 3 | |
match number: | |
case 1: | |
return "Yay you are number wan" | |
case 2: | |
return "Second mouse gets the cheese" | |
case three: | |
return "You came third" | |
case 42: |
This file contains hidden or 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 | |
choices = [chr(i) for i in range(ord('a'), ord('z'))] | |
with open('rawlist.py', 'w') as rl, open('splitlist.py', 'w') as sp: | |
rl.write('items = [\n') | |
sp.write('items = """\n') | |
for _ in range(1000000): | |
item = ''.join(random.sample(choices, 10)) | |
rl.write(" %r,\n" % item) | |
sp.write("%s\n" % item) |
This file contains hidden or 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
diff --git a/browser/base/content/browser-sets.inc b/browser/base/content/browser-sets.inc | |
Make quit shortcut be ctrl+shift+q | |
--- a/browser/base/content/browser-sets.inc | |
+++ b/browser/base/content/browser-sets.inc | |
@@ -299,11 +299,7 @@ | |
<key id="key_sanitize_mac" command="Tools:Sanitize" keycode="VK_BACK" modifiers="accel,shift"/> | |
#endif | |
<key id="key_quitApplication" data-l10n-id="quit-app-shortcut" | |
-#ifdef XP_WIN | |
modifiers="accel,shift" |
This file contains hidden or 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 unittest | |
from os.path import dirname | |
def make_suite(): # pragma: no cover | |
test_loader = unittest.TestLoader() | |
test_suite = test_loader.discover( | |
__name__, pattern='test_*.py', | |
top_level_dir=dirname(__file__), | |
) |
This file contains hidden or 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
// Insert the following function inside the kc3 developer console (which | |
// may be accessed by right-clicking on any of the Strategy Room pages, | |
// and select "Inspect", then open the console tab), and then navigate | |
// to any of the maps/event pages, invoke `sum_resources()` to get the | |
// total resources spent as per the consumption reported by each of the | |
// hover tooltip for all the visible sorties. | |
var sum_resources = () => { | |
var filter_icon = /<img src="\/assets\/img\/client\/([^\.]*).png"[^>]*>/g; | |
var values = $(".sortie_column.sortie_map").toArray().map(e => { |
This file contains hidden or 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 python | |
import sys | |
import zipfile | |
import json | |
import os | |
from io import BytesIO | |
from os.path import splitext | |
from math import ceil, floor, log | |
from time import perf_counter | |
from urllib.parse import urljoin |