Defending Against Ransomware On Windows Domains

security

Ransomware is increasingly becoming a serious issue for many companies. It's a type of malware that encrypts all data on and accessible by a computer, and holds the recovery key hostage until payment is made by a certain deadline. If the deadline passes without payment, the recovery key is destroyed and access to the encrypted data is permanently lost. With criminals making large sums of money using this method ransomware will continue to become even more commonplace in the future.

Plan For Recovery

Backups

A good first step is planning for recovery in the case of infection despite any of the protections put in place. Having timely, reliable backups is absolutely necessary and should be a focus regardless. Make sure there are regular bac...

Read more

Git Basics

development

Change User Information

One of the first things to do when setting up Git is to set your name and email. This information is included in each commit and is important when working on your own open source project, or contributing to another, so others can contact you if there are any issues.

To set your name and email for all repositories:

git config --global user.name "Enter your name here"
git config --global user.email "Enter your email here"

To set your name and email only for the current repository (overrides global settings):

git config user.name "Enter your name here"
git config user.email "Enter your email here"

Change Editor

The default editor for writing commit messages varies by oper...

Read more

List Comprehensions and Generator Expressions In Python

development

List Comprehensions

List comprehensions are a common idiom in Python for creating a new list. The elements of the new list are the result of an operation applied to each element in another sequence or iterable. An overview can be found in the official Python documentation here.

List Comprehension v.s. For Loop

The basic form of a list comprehension looks like this:

>>> numbers = [i for i in range(10)]
>>> print(numbers)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

This can be thought of as shorthand for the code below, which creates an empty list, iterates over the range of numbers, and appends each number to the list:

>>> numbers = []
>>> for i in range(10):
>>>     numbers.append(i)
>>> print(...

Read more

Managing SQLite Connections In Android

development

It can be difficult to correctly manage SQLite database connections in Android. Memory leak issues can occur when opening more database connections than have been closed. Also, some database writes may fail when creating and using more than one SQLiteOpenHelper object in your project.

There are a couple solutions to this problem. One is to wrap the SQLiteDatabase in a ContentProvider. I don't have much experience with this so I'm not sure if it's a good option or not, but it's worth looking into. The other option is to use the singleton pattern for your SQLiteOpenHelper class.

The singleton pattern is a design pattern that restricts the instantiation of a class to one object. Doing this ensures safe access to the database as all database...

Read more

Improving SSH Server Configuration

security

SSH is a common way to remotely control, or transfer data between, computers. It is a much more secure method compared to alternatives, such as Telnet, which transmit data in plain text. However, there are a few SSH server settings that can be improved. Below are a few changes to get you started.

Note: You'll want to make sure you aren't using any of the settings that will be disabled or changed.

Edit Or Add The Following Settings

Open the SSH server configuration file (/etc/ssh/sshd_config) in your editor of choice.

Port port_number

Replace port_number with your desired port number. Port numbers from 1024 to 65535 are usually a safe bet, just make sure it's not already in use by another service. SSH typically runs on port 22, but sel...

Read more