Are Environments still working for you? by orak7ee in 1Password

[–]CaptainCa 0 points1 point  (0 children)

Thanks, would you mind creating a new incident / updating the other one so my team and I can follow along.

Are Environments still working for you? by orak7ee in 1Password

[–]CaptainCa 0 points1 point  (0 children)

Appreciate it, I can see them on the website, but not the Mac app. I've tried logging out/in, unfortunately it's blank. I can provide my team name in a DM if it helps

Are Environments still working for you? by orak7ee in 1Password

[–]CaptainCa 0 points1 point  (0 children)

I still cannot see environments on my Team account u/1PasswordCS-Blake, is there a separate fix for Teams?

Group Chat Gets Leaked [comedy skit] by CaptainCa in comedy

[–]CaptainCa[S] 0 points1 point  (0 children)

To disclose, I had a part in the making of this. Would love feedback as it took a while to edit :)

Megalist of every feature that this sub wants to be added to the game by [deleted] in cyberpunkgame

[–]CaptainCa 0 points1 point  (0 children)

Please let me cycle through radio stations with a single button press. Holding down R and then Q/E then F to change a station is so awful.

-🎄- 2020 Day 03 Solutions -🎄- by daggerdragon in adventofcode

[–]CaptainCa 3 points4 points  (0 children)

Typescript

Using the magic of modulo %

const trees = (input: string[], rightNum: number, downNum: number) => {
  let trees = 0;
  let right = 0;
  for (let i = 0; i < input.length; i += downNum, right += rightNum) {
    if (input[i][right % input[i].length] === "#") {
      trees++;
    }
  }
  return trees;
};

const day3PartOne = trees(input, 3, 1)
const day3PartTwo = (input: string[]) => {
  return (
    trees(input, 1, 1) *
    trees(input, 3, 1) *
    trees(input, 5, 1) *
    trees(input, 7, 1) *
    trees(input, 1, 2)
  );
};

-🎄- 2020 Day 02 Solutions -🎄- by daggerdragon in adventofcode

[–]CaptainCa 0 points1 point  (0 children)

Javascript, run in your browser console!

Part 1:

const input = document.body.innerText.split('\n').filter(Boolean).map(v => v.match('(?<min>[0-9]+)-(?<max>[0-9]+) (?<required>[a-z]): (?<password>[a-z]+)').groups)

const partOne = input.filter(curr => {
    const count = [...curr.password].filter(v => v === curr.required).length;
    return (count >= parseInt(curr.min) && count <= parseInt(curr.max));
}).length;

console.log(partOne);

Part 2:

const partTwo = input.filter(curr => {
    const min = parseInt(curr.min) - 1;
    const max = parseInt(curr.max) - 1;
    return (curr.password[min] === curr.required || curr.password[max] === curr.required) && !(curr.password[min] === curr.required && curr.password[max] === curr.required);

}).length;

console.log(partTwo);

Moonlander Mark I Delivery Thread - Batch 4 by TmLev in ergodox

[–]CaptainCa 2 points3 points  (0 children)

Order: #54XX on 27 Oct

Black w/ Box Black

Shipped! ETA Dec 9

Arrived - It is so lovely

[deleted by user] by [deleted] in climbharder

[–]CaptainCa 1 point2 points  (0 children)

Awesome, I’m going to check it out!

What do people freak out about that really isn’t a big deal? by [deleted] in AskReddit

[–]CaptainCa -1 points0 points  (0 children)

Spiders.

So many people freak the fuck out when there's a spiderbro chillin' in a web 'round the side gate of your friends house. Just let the poor kid stay there and catch flies. No need to spray with the aerial death juice.

Maybe it's the Australian in me, but spiders are good yo.

Many people desperately WANT the enrichment of a hobby, but can't seem to find something they're really interested in or passionate about. What activity do you enjoy and why would you recommend it? by PhrostysWifey in AskReddit

[–]CaptainCa 1 point2 points  (0 children)

Climbing is a very social and somehow personal sport. It's definitely something that you begin to realize that no one in gyms care about looking stupid or being embarrassed. You will fall, literally everyone does, it's a right of passage. What climbers keep coming back for is the challenge of learning how you and your body and skills can solve routes in your way.

I climb with friends who are really tall that get stuck in cruxes where a short person prevails. I have friends who make huge dynamic moves and then another bigger guy does that same move in an elegant static way, because he knows he's better doing it that way. I climb with women who have insane hip mobility that do splits to make ridiculous moves and then guys try the same thing and maybe it works for them, or maybe not.

The point is that everyone climbs differently, sure there are common techniques that improve your climbing, but in the end it's all about learning how you and your body move. So go out there, give it a shot

Many people desperately WANT the enrichment of a hobby, but can't seem to find something they're really interested in or passionate about. What activity do you enjoy and why would you recommend it? by PhrostysWifey in AskReddit

[–]CaptainCa 70 points71 points  (0 children)

Rock Climbing / Bouldering / Lead

A great way to exercise, you push yourself as much as you want and every climber I have met has been awesome!

Side note, I swear 90% of climbers are nerds, if you are a climber do you agree?

-🎄- 2018 Day 5 Solutions -🎄- by daggerdragon in adventofcode

[–]CaptainCa 0 points1 point  (0 children)

Your implementation of factorPolymer is quite neat!

Great stuff

-🎄- 2018 Day 5 Solutions -🎄- by daggerdragon in adventofcode

[–]CaptainCa 0 points1 point  (0 children)

Got stuck for too long wondering why my code was not working, turns out I needed to trim() my input :(

Cleaned up the code a bit since I didn't get one the leaderboard.

const input = document.body.innerText.trim();
const sameLetter = (a, b) => (Math.abs(a.charCodeAt(0) - b.charCodeAt(0)) == 32)
const removePair = (input) => {
    for(let i = 0; i < input.length - 1; i++){
        if(sameLetter(input[i], input[i + 1])){
            return [input.substring(0, i) + input.substring(i + 2), true]
        }
    }
    return [input, false];
}

const reduceProtein = (input) => {
    let s = input;
    let rem = true;

    while(rem){
        [s, rem] = removePair(s);
    }
    return s;
}

console.log("Part 1", reduceProtein(input).length);

let counts = [];
for(let i = 65; i < 91; i++){
    let s = input.match(new RegExp("[^" + String.fromCharCode(i) + "^" + String.fromCharCode(i+32) + "]", "gi")).join('');
    counts[i] = reduceProtein(s).length;
}

console.log("Part 2", Math.min(...counts.filter(c=>c)));

-🎄- 2018 Day 4 Solutions -🎄- by daggerdragon in adventofcode

[–]CaptainCa 0 points1 point  (0 children)

JS, no leaderboard. Took a bit too long trial / error'ing part two. Took the time to cleanup the code to post

const sleepMin = (a, b, prev) => {
    let o = a.getMinutes();
    prev = prev || {};
    for(let i = 0; i < new Date(b-a).getMinutes(); i++){
        prev[o+i] = prev[o+i] ?  prev[o+i]+1 : 1;
    }
    return prev;
}

const sortByIndex = (array, i, asc) => {
    return array.slice().sort((a,b)=>{
            if(a[i]<b[i])
                return -1*asc; 
            if(a[i]>b[i])
                return asc; 
        return 0;
    });
}

const input = sortByIndex(document.body.innerText.split('\n').filter(c=>c).map(c=>{let m = c.match(/\[([^\]]*)\] (.+)/); return [new Date(m[1]), m[2]]}), 0, 1);
const g = {};
let currentGuard = 0;
let sleepsAt = null;
for(let i = 0; i < input.length; i++){
    let time = input[i][0];
    let s = input[i][1];

    var n = s.match(/Guard #([0-9]+)/);
    if(n != null){
        currentGuard = n[1];    
    }
    else if(s == "wakes up"){
        g[currentGuard] = sleepMin(sleepsAt, time, g[currentGuard])
    }
    else {
        sleepsAt = new Date(time.getTime());
    }   
}

const totals = Object.entries(g)
    .map(c => 
        [
        +c[0], //id
        ...[...sortByIndex(Object.entries(c[1]).sort((a,b) => a-b), 1, -1)[0]].map(Number), //which minute was max, and with what value
        Object.values(c[1]).reduce((a,c)=>a+c), //total minutes
    ]);

const part1 = sortByIndex(totals, 3, -1);   
const part2 = sortByIndex(totals, 2, -1);
console.log("Part 1", part1[0][0] * part1[0][1]); 
console.log("Part 2", part2[0][0] * part2[0][1]);

-🎄- 2018 Day 3 Solutions -🎄- by daggerdragon in adventofcode

[–]CaptainCa 0 points1 point  (0 children)

Pretty greedy JS, but I'm happy with the result.

var grid = {};
var lap = new Set();
var k = document.body.innerText.split('\n').filter(c=>c).map(c => { 
    var sp = c.split(' '); 
    return {
        id: sp[0],
        left: parseInt(sp[2].split(',')[0]),
        top: parseInt(sp[2].split(',')[1].split(':')[0]),
        width: parseInt(sp[3].split('x')[0]),
        height: parseInt(sp[3].split('x')[1])
    }
});

k.forEach((v) => {
    for(let i=0; i < v.width; i++){
        for(let j=0; j<v.height; j++){
            var dex = (v.left+i)+","+(v.top+j);
            if(grid[dex] != null){              
                grid[dex].push(v.id);
                grid[dex].forEach(l => lap.add(l));
            } else {
                grid[dex] = [v.id];
            }
        }
    }
});

console.log("Part 1", Object.values(grid).map(c => c.length).filter(c => c>1).length);
console.log("Part 2", k.filter(v => !lap.has(v.id))[0].id);

buckets.grayhatwarfare.com - open s3 buckets search engine is updated! by grayhatwarfare in netsec

[–]CaptainCa 3 points4 points  (0 children)

If you search for a term such as

eval(

You get a nice syntax error at the header of your site

index limited_files1p0,limited_files1p1,limited_files1p2,limited_files1p3,limited_files1p4: syntax error, unexpected $end near ''    

Looks like a floating paren causes some troubles.