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
| #!/bin/bash | |
| # Takes: | |
| # - An input file with a list of hostnames to resolve | |
| # - An old DNS server address | |
| # - A new DNS server address | |
| # | |
| # Output will be a diff between the behaviour of the two DNS servers for the domains given. | |
| set -euo pipefail |
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
| _BASE64_PADDING = "=" | |
| def strip_base64_padding(string: str) -> str: | |
| """Strip padding of equals sign from base64. Required for use in urls.""" | |
| return string.rstrip(_BASE64_PADDING) | |
| def unstrip_base64_padding(string: str) -> str: | |
| """Re-pad a base64 string with the right amount of padding.""" |
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 _base64_length(bytes_length: int) -> int: | |
| """Return the maximum length a base64 encoded string would be for the | |
| given length of bytes. | |
| Note that this length may change if padding is stripped. | |
| """ | |
| # base64 length is 33% longer, rounding up | |
| return ceil((bytes_length / 3) * 4) |
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
| extern crate encoding_rs; // 0.8.33 | |
| fn main() { | |
| let data: Vec<u8> = vec![46, 0, 120, 0, 108, 0, 115, 0, 120, 0]; | |
| let mut buffer: String = String::with_capacity(data.len() * 2); | |
| let mut decoder = encoding_rs::UTF_16LE.new_decoder(); | |
| let (coder_result, read, replaced) = decoder.decode_to_string(&data, &mut buffer, true); | |
| assert!(coder_result == encoding_rs::CoderResult::InputEmpty); |
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
| #[derive(Default)] | |
| struct Potato { | |
| cool: bool, | |
| } | |
| impl Potato { | |
| fn cooldown(&mut self) { | |
| self.cool = true; | |
| } | |
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
| use std::convert::TryInto; | |
| const RADIX: u32 = 85; | |
| const INPUT_BLOCK_SIZE: u32 = 4; | |
| const OUTPUT_BLOCK_SIZE: u32 = 5; | |
| #[inline] | |
| /// Read a block of four `u8`s in as a single big-endian u32. | |
| fn read_u32(s: &[u8]) -> u32 { | |
| u32::from_be_bytes(s[..4].try_into().unwrap()) |
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
| #!/bin/sh | |
| function log() { | |
| printf "$@\n" >&2 | |
| } | |
| function command_exists() { | |
| command -v "$1" 2>&1 > /dev/null | |
| return $? | |
| } |
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
| \x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x89\xc2\xb0\x0b\xcd\x80 |
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
| // This file is distributed under the terms of the GNU GPL v2 | |
| // ImageJ macros file | |
| // To install these to your ImageJ program temporarily: | |
| // - Plugins > Macros > Install... (Ctrl-Shift-M) | |
| // To install these to your ImageJ program permenantly: | |
| // - Find the "StartupMacros.txt" file on your computer | |
| // - e.g. C:\Program Files (x86)\ImageJ\macros\StartupMacros.txt (Windows) | |
| // - e.g. /Applications/ImageJ/macros/StartupMacros.txt (Mac) | |
| // - Copy and paste the contents of this file at the end of StartupMacros.txt |
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 os | |
| import sys | |
| import glob | |
| import argparse | |
| from itertools import zip_longest | |
| import WhatColorIsX | |
| from PIL import Image, ImageDraw, ImageColor, ImageOps, ImageFont |
NewerOlder