Skip to content

Commit

Permalink
Addl Markdown cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
krmaxwell committed Mar 12, 2017
1 parent ba66852 commit d2946a4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 25 deletions.
23 changes: 5 additions & 18 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
rules "~MD013"
rules "~MD013,~MD023,~MD026,~MD029,~MD033,~MD036"

# MD001 Header levels should only increment by one level at a time
# MD002 First header should be a h1 header
# MD003 Header style
# MD004 Unordered list style
# MD006 Consider starting bulleted lists at the beginning of the line
# MD007 Unordered list indentation
# MD011 Reversed link syntax
# MD013 Line length
# MD025 Multiple top level headers in the same document
# MD026 Trailing punctuation in header
# MD023 Headers must start at the beginning of the line (doesn't work for code comments)
# MD026 Trailing punctuation in header (I almost like this rule but need to allow ?s)
# MD029 Ordered list item prefix
# MD030 Spaces after list markers
# MD032 Lists should be surrounded by blank lines
# MD033 Inline HTML
# MD033 Inline HTML (sometimes you just gotta)
# MD036 Emphasis used instead of a header
# MD037 Spaces inside emphasis markers
# MD038 Spaces inside code span elements *
# MD039 Spaces inside link text
# MD040 Fenced code blocks should have a language specified *
# * = only occurs for markdownlint and/or remark

2 changes: 1 addition & 1 deletion _posts/2015-02-18-targeted-personal-attacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ categories: Security, Activism

I've been thinking lately about different threat models, especially those where an adversary focuses on a particular target. Frequently, discussions around "advanced persistent threats" (APTs) get lost in marketing FUD or military policy discussions. My previous research on the [incident types](http://nbviewer.ipython.org/url/threatic.us/Clustering.ipynb) shows clear differences, though. The typical TTPs (tactics techniques and procedures) associated with targeted incidents, especially those with an espionage motive, vary significantly from those carried out by attackers with a financial motive. Much of these differences stem from the targeted nature of these attacks.

This "targeted vs opportunistic" dichotomy in infosec applies to incidents involving individuals too, not just organizations. The typical advice given about online safety focuses on opportunistic attackers with a financial motive.
This "targeted vs opportunistic" dichotomy in infosec applies to incidents involving individuals too, not just organizations. The typical advice given about online safety focuses on opportunistic attackers with a financial motive.
If advice to individuals is based on hardening their defenses just enough not to present the easiest target, it misses quite a bit. Telling somebody they don't have to run faster than the bear, just faster than the next person, makes assumptions about the bear. Those assumptions - the bear just wants the nearest meal, the bear will be satisfied with only one victim, only one bear is giving chase - may not hold up under close examination.

As a more concrete example, think about the threat models of stalkers, abusers, or harassers. In these types of cases, victims find themselves with entirely different types of impact. Sometimes that means financial losses, like fraud or flat-out theft. All too often, it leads to physical trauma and [emotional abuse][2] or even murder.
Expand Down
1 change: 1 addition & 0 deletions _posts/2015-04-02-open-source-software-engineering.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ In the process of 'leveling up' as a programmer, I have started trying to implem
When implementing engineering guidelines in community-developed projects (such as open source software), we have to take a few steps. GitHub will show a link to a [contributor guide](https://github.com/blog/1184-contributing-guidelines) on all issue and pull request pages. The guidelines document should explain the process, as well as any other considerations (such as licensing and coding standards).

# Basic flow

I've used the [**Github Flow**](https://guides.github.com/introduction/flow/) for quite a while for lots of things (recently including even [this blog](https://github.com/krmaxwell/krmaxwell.github.io)). But this mostly applies to processes that use continuous deployment, like GitHub itself. It can also work pretty well for documentation and other similar projects that don't need the concept of "releases".

For projects with staged releases, we need a few more bits. The git branching model [documented](http://nvie.com/posts/a-successful-git-branching-model/) by [Vincent Driessen](https://twitter.com/nvie) has become quite popular lately. I think it really just shows how to use git for implementing a very common model we've used for a long time. (I recall using this basic approach twenty years ago when our source code collaboration just relied on using a whiteboard to document who had which file checked out. That sucked as hard as it sounds.)
Expand Down
4 changes: 2 additions & 2 deletions _posts/2015-04-03-python-tricks-counting.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ for each in data:

We can simplify this even further with a _list comprehension_. In general, you place a `for` loop inside a pair of square brackets, with the expression for each result at the beginning.

## Old and busted:
## Old and busted

{% highlight python %}
counts = collections.Counter()
for each in data:
counts[each] += 1
{% endhighlight %}

## New hotness:
## New hotness

{% highlight python %}
[counts[each]+=1 for each in data]
Expand Down
1 change: 1 addition & 0 deletions _posts/2015-04-07-python-tricks-setdefault.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ print(myDict) # {'lname': 'Thompson', 'fname': 'Kevin'}
{% endhighlight %}

## What about defaultdict?

The `collections` library in python gives us `defaultdict` which does something pretty similar to what we have done above. With `defaultdict` we create a dictionary and define a default container that will apply to *every* missing key. So if you want to create a dictionary that will hold other dictionaries, you can do something like this:

{% highlight python %}
Expand Down
7 changes: 4 additions & 3 deletions _posts/2015-05-07-tempfile-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Imagine a program that needs to store a bunch of files in a directory (possibly

Fortunately for us, Python provides the [tempfile module](https://docs.python.org/2/library/tempfile.html) with some functions to help us: `mkstemp()` and `mkdtemp()`.

## [mkstemp()](https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp)
# [mkstemp()](https://docs.python.org/2/library/tempfile.html#tempfile.mkstemp)

From the documentation:

Expand All @@ -32,6 +32,7 @@ except OSError:
```

Let's walk through this:

- Wrapping everything in a `try/except` block lets us catch potential exceptions.
- We assign the variables `fd` and `temp_path` to the tuple returned by the `mkstemp()` call. The `dir` parameter to that call allows us to specify the directory in which we want to test file creation.
- Close the file descriptor for the open (temporary) file within our program so that the OS doesn't have stale handles hanging around. Then remove the file itself.
Expand All @@ -41,7 +42,7 @@ At this point, your program can proceed to write securely to `my_dir`. Of course

If you want to use the temporary file for something else (scratch space), you don't have to close the descriptor and remove the path right away. But you will still need to do all that before your program exits. In that case, consider [`NamedTempFile()`](https://docs.python.org/2.7/library/tempfile.html#tempfile.NamedTemporaryFile).

## [mkdtemp()](https://docs.python.org/2/library/tempfile.html#tempfile.mkdtemp)
# [mkdtemp()](https://docs.python.org/2/library/tempfile.html#tempfile.mkdtemp)

This function is the sibling of `mkstemp()` but instead creates a temporary directory for whatever you need. Fortunately for us, it's a lot easier to use since we don't have to deal with file descriptors. This is great if your program just needs a temporary workspace to store some files before moving or removing them. The example might look like:

Expand All @@ -55,6 +56,6 @@ except OSError:

This works almost identically except for the lack of a file descriptor to track and close. Again, your program can use the temporary directory for a bit and move the `os.rmdir()` call outside the `try`.

## Conclusion
# Conclusion

I use this sort of pattern in [Maltrieve](http://maltrieve.org) for checking the archive directory before saving off retrieved malware. If you have suggestions on other use cases, or better ways to do this, I'd love to chat with you on [GitHub](https://github.com/krmaxwell/krmaxwell.github.io/pull/68) or [Twitter](https://twitter.com/kylemaxwell).
4 changes: 3 additions & 1 deletion _posts/2015-05-13-learning-new-programming-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ I decided a couple of decades ago that I wanted to speak Spanish beyond the very
This demonstrates a good model for learning programming languages.

# Do the work

[![talent](/assets/images/talent-development.png)](http://threepanelsoul.com/2015/05/11/talent/)

**There is no shortcut to success in learning. You have to do the work.** People love to talk about how much they "want" to learn something, or how they started and got distracted. Somehow they often give the impression that that's almost as good.
Expand All @@ -20,6 +21,7 @@ Learning a new skill requires time and effort. While [Learn X in Y minutes](http
Note, I certainly understand that other people may learn in different ways. The whole issue of learning theory and pedagogy lies well outside my expertise. So the rest of this post will just discuss what has worked for me. Hopefully somebody else can get some good ideas they can use out of it.

# Build your knowledge

Personally, I prefer instruction oriented toward people who already understand code. Explanations of the concept of variables and basic logic constructs wastes my time. Instead, give me a good explanation of syntax (the grammar, as it were). For a programmer with an existing skill set, resources like [Learn Code the Hard Way](http://learncodethehardway.org/) work much better than [Codecademy](http://www.codecademy.com/learn).

NB: "X for Dummies"-styled instruction is a total non-starter for me. I'm not a dummy just because I don't know X yet, and neither are you. You are a smart, capable person who wants to learn something new. We should celebrate the desire to learn, not feed into a societal psychosis that rejects _knowing things_.
Expand Down Expand Up @@ -52,6 +54,6 @@ Collaborating with others also helps. We each know different sorts of things, so

# Wrapping up

This process never ends, by the way. I will never reach a point where I've learned all I need to know about programming, because that's the path to irrelevancy. (My knowledge of Spanish gets better all the time, too, because I apply it every day.)
This process never ends, by the way. I will never reach a point where I've learned all I need to know about programming, because that's the path to irrelevancy. (My knowledge of Spanish gets better all the time, too, because I apply it every day.)

With that in mind, I've started learning Go lately. The adventure begins again...

0 comments on commit d2946a4

Please sign in to comment.