Compare commits
10 commits
983405a9f3
...
7d3a51cdfd
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d3a51cdfd | |||
| 3820726136 | |||
| 40e256c48f | |||
| 11abc83110 | |||
| 50e00e8cd2 | |||
| eda7c79437 | |||
| e0152e2970 | |||
| 7ec1af8a5e | |||
| 7fe385c919 | |||
| 35f2ccc54a |
5 changed files with 72 additions and 41 deletions
|
|
@ -5,15 +5,14 @@ slug: about
|
|||
---
|
||||

|
||||
|
||||
By day I'm a Site Reliability Engineer on the Cluster Operations team at
|
||||
By day I'm a Site Reliability Engineer on the Fleet Automation team at
|
||||
[Dropbox](https://dropbox.com), where I help provide the tools and services to
|
||||
automate our datacenters, things such as server provisioning, serve repair
|
||||
validation, asset management, etc.
|
||||
automate our datacenters, things such as server provisioning, OS installation,
|
||||
server repair validation, asset management, etc.
|
||||
|
||||
Outside of work I'm usually found riding bikes (sometimes for long distances
|
||||
carrying camping gear), wrenching on bikes, drinking too much coffee, drinking
|
||||
not-too-much beer, brewing the former two, or writing code to support my
|
||||
hobbies.
|
||||
carrying camping gear), wrenching on bikes, playing around with ham radio,
|
||||
drinking too much coffee, or writing code to support my hobbies.
|
||||
|
||||
I'm a huge proponent of free open-source software and maintaining control of
|
||||
your data.
|
||||
|
|
|
|||
|
|
@ -43,11 +43,6 @@ Links: [Project page](/cpu-usage-meter/), [Linux source](/media/projects/cpu_met
|
|||
|
||||
LEDs on the front of my computer case displaying the CPU load.
|
||||
|
||||
### Serial IR Receiver (2006)
|
||||
Links: [Project page](/ir-receiver/)
|
||||
|
||||
A simple serial-based LIRC-compatible IR reciever.
|
||||
|
||||
### ServCheck (PHP)
|
||||
Links: [servCheck.tar.gz](/media/projects/servCheck.tar.gz)
|
||||
|
||||
|
|
@ -55,19 +50,3 @@ A simple service checker written in PHP. Attempts to open a socket with the
|
|||
configured hosts and ports, and outputs an HTML file showing which services
|
||||
are up and down. I originally wrote this for the TerminalUnix site to show what's
|
||||
working and what isn't.
|
||||
|
||||
### TerminalUnix (PHP)
|
||||
A PHP and MySQL driven site, functioning as a web front-end and community site for
|
||||
the TerminalUnix server. I started it because I was sick of all of these Content
|
||||
Management Systems having features that I didn't want. I sat down during Spring Break
|
||||
of 2006 and coded a PHP login system, not knowing about the wonders of some of the PHP
|
||||
features. Eventually I coded nice things in such as MySQL access (instead of a flat
|
||||
text file), a user adminstration system, and even a news sytem.
|
||||
|
||||
Unfortunately I don't plan on releasing the source code since it's a big hard-coded mess.
|
||||
|
||||
### N-Queens solver (C++)
|
||||
Links: [nqueens.tar.gz](/media/projects/nqueens.tar.gz)
|
||||
|
||||
Another Data Structures homework assignment. This solves (brute-forces) the
|
||||
[N-Queens Problem](https://www.google.com/search?q=n-queens+problem) using recursion and backtracking.
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ ACTION=="remove", \
|
|||
```
|
||||
|
||||
The VENDOR_ID and MODEL_ID can be found by running the `lsusb` command, which
|
||||
shows this as "ID <vendor id>:<model id>", for example "ID 6b62:6869".
|
||||
shows this as "ID vendor_id:model_id", for example "ID 6b62:6869".
|
||||
|
||||
And of course, here's the script `/usr/local/bin/kvm-udev` which takes care of
|
||||
the auto-connecting. It takes two parameters, first either being "attach" or
|
||||
|
|
|
|||
58
posts/2022-07-11_cheating_at_wordle_with_grep.yaml
Normal file
58
posts/2022-07-11_cheating_at_wordle_with_grep.yaml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
date: 2022-07-11
|
||||
title: 'Cheating at Wordle with grep'
|
||||
tags:
|
||||
- linux
|
||||
---
|
||||
I usually try to make a good effort at
|
||||
[Wordle](https://www.nytimes.com/games/wordle/index.html), but sometimes I get
|
||||
down to the last one or two chances and need some help. Instead of anything
|
||||
fancy-pants, I usually turn to a dictionary file and my friend, `grep`.
|
||||
|
||||
So, first thing's first, you need a dictionary file, which is just a file with
|
||||
a bunch of words one-per-line. These are usually found in `/usr/share/dict`. I
|
||||
happen to have `cracklib-small` on my machine so we'll use that.
|
||||
|
||||
First, you'll want to get all the five-letter words out of the file. I use the
|
||||
regex `^\w{5}$`, which is `^` for the start of the line, `\w` for an
|
||||
alphanumeric character, `{5}` saying that there are 5 of them, and `$` for the
|
||||
end of the line. The beginning and end of line markers are important, otherwise
|
||||
you'll get words that contain 5 or more letters.
|
||||
|
||||
```
|
||||
grep -E '^\w{5}$' /usr/share/dict/cracklib-small
|
||||
```
|
||||
|
||||
At this point, I've already made some guesses and have a few letters in the
|
||||
right spot, and some letters which are correct but in the wrong spot. We'll
|
||||
bucket these into two `grep`s.
|
||||
|
||||
For letters in the right spot, I stick those right into a regex. For example,
|
||||
let's say I know the word starts with 'f' and 'a':
|
||||
|
||||
```
|
||||
grep -E 'fa\w\w\w'
|
||||
```
|
||||
|
||||
For the right letters in the wrong spot, I simply use the letter as the regex.
|
||||
If I have multiple letters, I can chain those together by piping grep like so:
|
||||
|
||||
```
|
||||
grep s | grep t
|
||||
```
|
||||
|
||||
So chaining them all together:
|
||||
|
||||
```
|
||||
$ grep -E '^\w{5}$' /usr/share/dict/cracklib-small \
|
||||
| grep -e 'fa\w\w\w' \
|
||||
| grep s | grep t
|
||||
facts
|
||||
fasts
|
||||
fates
|
||||
faust
|
||||
```
|
||||
|
||||
You could eliminate words that have letters you've already eliminiated by
|
||||
chaining `grep -v <letter>` to the end, but I find that pretty cumbersome.
|
||||
There's only a handful of possible words at this point, so I think it's easier
|
||||
to just remove them in my head.
|
||||
|
|
@ -16,6 +16,8 @@
|
|||
<link rel="stylesheet" href="{{ "css/font-awesome.css" | media_url }}" />
|
||||
|
||||
<link rel="stylesheet" href="{{ "css/index.css" | media_url }}" />
|
||||
|
||||
<script defer src="https://webstats.nickpegg.com/script.js" data-website-id="45f9e233-7863-478e-bbf1-39393bbde614"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
|
|
@ -45,6 +47,11 @@
|
|||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<li>
|
||||
<a href="https://wiki.nickpegg.com">
|
||||
Wiki
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/rss.xml">
|
||||
<i class="fa fa-rss-square"></i>
|
||||
|
|
@ -62,23 +69,11 @@
|
|||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://mastodon.social/@nickpegg">
|
||||
<a rel="me" href="https://sfba.social/@nickpegg">
|
||||
<i class="fa fa-comments"></i>
|
||||
Mastodon
|
||||
</a>
|
||||
</li>
|
||||
<!--<li>
|
||||
<a href="https://instagram.com/nickpegg0">
|
||||
<i class="fa fa-instagram"></i>
|
||||
Instagram
|
||||
</a>
|
||||
</li>-->
|
||||
<li>
|
||||
<a href="https://twitter.com/nickpegg">
|
||||
<i class="fa fa-twitter-square"></i>
|
||||
Twitter
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://linkedin.com/in/nick-pegg">
|
||||
<i class="fa fa-linkedin-square"></i>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue