Skip to content

Instantly share code, notes, and snippets.

@sourcefrog
sourcefrog / gist:44f4e6ba2519d56898491c37e265f851
Last active March 28, 2024 17:42
AWS IAM tips and traps
Negative condition keys like `StringNotLike` are *true* if the key is not present: so, if you want to allow something unless
a certain tag value is set, you will by default allow it if the tag is not present. You need to specifically match that too.
Some calls like DescribeSnapshots and DescribeImages will by default return resources not owned by your account, but
accessible to it (e.g. public); you might need to filter down to see only your own resources.
DeleteObject takes a parameter to delete a non-current object version, but you need a specific
`s3:DeleteObjectVersion` permission to use it.
Similarly, `PutObject` into a bucket with default object locks requires a permission to create the lock(??).
; nice cargo mutants -d ~/src/imbl
Freshen source tree ... ok in 14.316s
Copy source and build products to scratch directory ... 559 MB in 0.489s
Unmutated baseline ... ok in 15.745s
Auto-set test timeout to 78.5s
Found 836 mutants to test
src/vector/mod.rs:1904: replace <impl Sum for Vector<A>>::sum -> Self with Default::default() ... NOT CAUGHT in 22.992s
src/hash/set.rs:939: replace <impl From for HashSet<A, S>>::from -> Self with Default::default() ... NOT CAUGHT in 17.512s
src/ord/set.rs:113: replace <impl BTreeValue for Value<A>>::ptr_eq -> bool with true ... NOT CAUGHT in 17.951s
src/ord/map.rs:1220: replace OrdMap<K, V>::symmetric_difference_with -> Self with Default::default() ... NOT CAUGHT in 18.657s
@sourcefrog
sourcefrog / mutants.log
Created August 6, 2022 14:49
cargo-mutants on fs_at
Freshen source tree ... ok in 0.333s
Copy source and build products to scratch directory ... 58 MB in 0.107s
Unmutated baseline ... ok in 0.248s
Auto-set test timeout to 20.0s
Found 41 mutants to test
src/win.rs:83: replace OpenOptionsImpl::read with () ... NOT CAUGHT in 0.119s
src/win.rs:514: replace <impl OpenOptionsExt for OpenOptions>::security_qos_effective_only -> &mut Self with Default::default() ... NOT CAUGHT in 0.483s
src/win/sugar.rs:21: replace <impl Display for NTStatusError>::fmt -> fmt::Result with Ok(Default::default()) ... NOT CAUGHT in 0.117s
src/win.rs:253: replace OpenOptionsImpl::get_access_mode -> Result<DesiredAccess> with Ok(Default::default()) ... NOT CAUGHT in 0.118s
src/win.rs:95: replace OpenOptionsImpl::create with () ... NOT CAUGHT in 0.117s
for i in (seq 0 255)
set_color (printf '%02x0000\n' $i); echo -n xxi
end
def cw(w):
r = 0
iw = False
for c in w:
if c == ' ':
if iw:
r += 1
iw = False
else:
iw = True
@sourcefrog
sourcefrog / repaint.rs
Created January 8, 2017 04:18
Demonstrate rust term and iTerm2 problems
extern crate term;
fn main() {
let mut t = term::stdout().unwrap();
t.fg(term::color::BRIGHT_GREEN).unwrap();
t.bg(term::color::BLUE).unwrap();
write!(t, "hello 123123123123123123").unwrap();
t.carriage_return().unwrap();
t.flush().unwrap();
t.bg(term::color::BLACK).unwrap();

Keybase proof

I hereby claim:

  • I am sourcefrog on github.
  • I am mbp (https://keybase.io/mbp) on keybase.
  • I have a public key ASBLKfQMSbQYaBptBJ0Vb4JKqBvTb2Byse6r7TXyTj1cywo

To claim this, I am signing this object:

#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/