teleren/devto huggingface dataset:
My password policy
Tags: passwords, security, motivation
Published: 2019-07-27 04:54:28

---
title: My password policy
published: true
description: How I choose a password, not just for compliance but for motivation
tags: passwords, security, motivation
---
[**Note**: I'm going to give examples of passwords in this post. None of them is or has ever been my password for anything. Also I'm using "password" but "passphrase" is probably better.]

Like most people in the business, I have to use passwords many times a day.

Like most people in the business, I have to change those passwords frequently, and they have to match a password policy: uppercase, lowercase, numbers and special characters.

Here's my system for making it as painless as possible.

* Start with an uppercase word. This way you hold down shift, or use caps lock, all in one unbroken string, then forget about it.
* Use dashes between the different parts of the password. Most  "special character" policies don't require anything more special than "not alphanumeric". And you don't need to hold down a modifier key for dashes.
* Use numbers which match words like 4 for "for" etc. which are easy to remember, and failing that replace letters with numbers

And the final one which makes all the difference:

* Make it something inspiring or motivational

Say you're thinking of learning a new language this year. Your password could be `LEARN-1-new-language` or `LEARN-2-code-in-Perl`. Because you're going to type that thing many times a day, right? Why make it a random string like `GH^C6e36y%7w` (thanks LastPass) when it could be `DO-100-days-of-code`, or `WORK-on-th4t-side-project`?

How about a fitness goal like `BENCH-press-50-kilos` or `RUN-a-faster-5K`? Or maybe a mindfulness goal like `READ-4-books-this-month` or `MAKE-time-2-meditate` or a social/political one like `GIVE-more-2-charity` or `DONATE-to-2020-candidate`?

You can probably think of better ones for yourself. And of course, vary the rules for extra security. Maybe the uppercase string goes at the end, or you use something other than dashes.

But we might as well redecorate that little room in our brains, which we have to visit so many times a day, with something which inspires us a little.
Testing Powershell code with Tomty framework.
Tags: powershell, perl6, microsoft, testing
Published: 2019-07-27 03:11:35

---
title: Testing Powershell code with Tomty framework.
published: true
description: How to test Powershell code using Perl6 and Tomty
tags: powershell, Perl6, Microsoft, testing
---

> There is more then one way to test it ...

How to test Powershell modules using Perl6 and [Tomty](https://github.com/melezhik/Tomty)


# Welcome Tomty

[Tomty](https://github.com/melezhik/Tomty) is a [Sparrow6](https://github.com/melezhik/Sparrow6) based testing framework, written in Perl6. We use it to write tests.

# Install


    zef install Tomty

# Usage

## Write Powershell module

`modules/hello/hello.ps1`

    function Hello {
    
      param(
        [Parameter(Mandatory=$true)]
        [String]$name
      )
    
      Write-Host Hello $name
    }

## Write wrapper

    mkdir -p .tomty/tasks/test-hello

`.tomty/tasks/test-hello/task.ps1`:

    Import-Module hello
    $name = config 'name'
    Hello -name $name

`.tom/tasks/test-hello/task.check`:

    generator: print "Hello ".( config()->{name} )

## Write test

`tomty --edit test-hello`

    task-run ".tomty/tasks/test-hello", %( name => "Sparrow6" )

## Run test

`PSModulePath=$PWD/modules tomty test-hello`


```
02:47:26 07/27/2019 [repository] index updated from file:///home/melezhik/repo/api/v1/index
02:47:26 07/27/2019 [.tom/tasks/test-hello] Hello Sparrow6
[task check] stdout match <Hello Sparrow6> True
```

## Run more tests

Once you have more tests, you run them all:

`tomty --all`


See [Tomty](https://github.com/melezhik/Tomty) documentation for other options.

---

Thank you for reading. I'd appreciate comments.
CSS Only Image - Beginner
Tags: codepen, css, dailycssimages, begineers
Published: 2019-07-27 02:24:58

---
title: CSS Only Image - Beginner
published: true
tags: codepen, CSS, dailycssimages, begineers
---
<p>I have been wanting to try CSS only images for a very long time. When I found <a href="https://dribbble.com/shots/3174839-Awsome-iOS-Logo-Concept" target="_blank">this sketch</a> by <a href="https://dribbble.com/becampanha" target="_blank">Bruno Echenique Campanhã</a> on google images I wanted to try it with only CSS.</p>

{% codepen https://codepen.io/bhuvana/pen/NQroqe %}

###Challenges Faced
1. Creating concentric circles and lines in the background without any extra markups


###Concepts learnt
1. How to efficiently breakdown an image to divs (which should be nested and in which order)
2. How to **not** use too many markups

###CSS Properties learnt
1. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient" target="_blank">linear gradient</a>
2. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/radial-gradient" target="_blank">radial gradient</a>
3. <a href="https://developer.mozilla.org/en/docs/Web/CSS/clip-path" target="_blank">clip-path</a>


###Helpful Resources
1. <a href="https://bennettfeely.com/clippy/" target="_blank">Clippy</a> 
2. <a href="https://shapy.app/" target="_blank"> Shapy- Gradient shape editor by Victoria</a>
3. <a href="https://coding-artist.teachable.com/" target="_blank">Starter course for absolute CSS Images begineer by Michael Mangialardi</a>
Exploring Factory Functions
Tags: javascript, intermeadiate
Published: 2019-07-27 01:44:48

Looking at the words, **factory** and **function** would paint a picture of a function which creates objects. That's exactly what factory functions do. They are blueprints for object creation. More like classes. But milder, without the syntactic sugar. 

Factory functions allow for speedy object creation by just calling the function with a few parameters here and there. Say we want a Sims factory. We would need a function which outputs Sims with the following properties:
1. Name
2. Age
3. Gender

## The factory
```javascript
const makeSim = (name, age, gender) => {
  return {
    name, 
    age,
    gender
  };
}
```
The function simply returns an object.
Now that we have that in place, we can add methods to this object.

```javascript
const makeSim = (name, age, gender) => {
  return {
    _name:name, 
    _age:age,
    _gender:gender,
    _occupation:occupation,
    _interests:interests, 
    get name() {return this._name},
    get age() {return this._age},
    get gender() {return this._gender}
  }
};
const Sam = makeSim('Samuel', 23, 'male');
console.log(Sam);    // outputs {name: "Sam", age: 23, gender: "male"}
console.log(Sam.name);    //outputs Samuel
```

So that's my little say on factory functions. Post your views on the topic in the comment section. Thanks.
Modelling data for NoSQL databases
Tags: showdev, mongodb, nosql, database
Published: 2019-07-29 12:07:57

---
title: Modelling data for NoSQL databases
published: true
tags: ['showdev', 'MongoDB', 'NoSQL', 'databases']
canonical_url: https://learnwithparam.com/tech-talks/modelling-data-for-nosql-databases/
series: Awesome talks curated by Param
---

Thinking process for NoSQL is completely different from SQL. If you come from SQL background, this video talk will help you learn how to think data modelling from NoSQL perspective.

{% youtube IUxT7ZRHlZ4 %}
Git Which Ignores
Tags: git, vsc
Published: 2019-11-12 14:33:56

---
title: Git Which Ignores
published: true
tags: git, vsc
canonical_url: https://tech.serhatteker.com/post/2019-07/git-which-ignores/
---

You just started a new project that a team has working on for a while and like to add your code into the codebase. Or you want to use a well-known webapp template for your new project.

You wrote the code, made your tests and then added your "piece of magic" text but it doesn't show up in `version control`. `git status` not showing your file or directory. Also you can't check manually `.gitignore` since it is 450 lines long.

The solution? Use built-in git command `check-ignore`:

```git
$ git check-ignore -v filename
```


For instance; you wrote `bash`scripts for some automation and added them in a directory called `scripts` in the project root. When you use `check-ignore` it would give some output like below:

```
.gitignore:274:[Ss]cripts       scripts
```

Which basically says: on the line "274" `[Ss]cripts` causes to ignore your `scripts` directory.


All done.
Github Must Be a Free Platform
Published: 2019-07-26 23:11:25


Github was a free platform for everyone since many years ago, but it has decided to restrict **Iranian accounts**.
We believe living in a country is not a choice that you have, but being a developer and contributing to the open-source community is a choice.
Github has restricted us from our freedom to contribute and being part of the open-source ecosystem because we are living in Iran.

**Github blocked our private repositories without warning us, and now we have no access to our codes.**

People should not be judged based on their living country. Github might decide to restrict a government, but it should not ban its active and loyal users without any prior caution.

I think having a **simple Github page** is a fundamental right for users.
Don't make us leave the open-source community.

{% github 1995parham/github-do-not-ban-us %}
Question pivoting for faster results
Tags: optimization
Published: 2019-07-26 20:35:53

---
title: Question pivoting for faster results
published: true
description: Sometimes you just have to try a different angle.
tags: #optimization
---

In my job, as the subject matter expert of the monitoring system we've brought on and use, I get the odd question from our support team.  Some are obvious to me, some are worthy of an article in an internal knowledge base, and some... well...

"Hey Red, maybe this will be quicker.  I need a list of all Linux servers that have under four gigs of RAM and MySQL installed.  Can you query the monitoring system database quickly?"

I said I'll check into it.  With some time on my hands I did...

And this is where I curse H.P. Lovecraft and fight great old eldritch horrors.

You see, the monitoring system's database layout isn't all that great.  It's optimized for fast writing, a choice the vendor of said system made a long time ago.  Plus, their reporting features only get you so far, and the use of MySQL in the past and MariaDB now makes me want to file bug reports for features in MS SQL Server (at least MariaDB has "WITH alias AS (SELECT statement)" now!).  Plus, data I need isn't in a normal structure -- no, it's captured by convoluted means and placed in the fast write structure tables.

Which means to get the list, I can't really use MySQL or MariaDB's SQL language.  It's not that capable.  It took me 2.5 hours of frustration to realize that.

I give up, talk to the guy who asked the question... and realized an easier way.  I was initially looking for Linux servers with 2 gigs of RAM.  I could of said "What Linux servers have MySQL on them?"  The monitoring system has a fast query page that lets me ask that, without going through the database or tearing my hair out.  I was able to say "Okay, do this, you get the list of 130 servers to check the RAM on."  The support guy said "I'll take that!" and can easily dig through them to get a shorter list.

The point here is that sometimes, you have to reorder the question and do a bit of optimization yourself.  SQL servers do this all the time, gathering some info on the query, reordering the searches needed, and producing a fast execution path.
What's the best way to report a security hole to a small company?
Tags: discuss, security
Published: 2019-07-26 21:47:12

I was looking for some help on an issue I was facing and I accidentally stumbled upon a service from another company which was exposed to the public internet. 

This service allowed exporting the raw configuration,  API keys, usernames, passwords, urls, etc. D:

I tried to find a contact to reach out to, but I wasn't able to find anything on their site. The contact on their site is only for sales and press, of which I want neither.

How would you handle this situation?
Differences in memory management between Direct3D 12 and Vulkan
Tags: directx, vulkan, gpu
Published: 2019-07-27 15:20:28

---
title: Differences in memory management between Direct3D 12 and Vulkan
published: true
tags: directx,vulkan,gpu
canonical_url: http://asawicki.info/news_1711_differences_in_memory_management_between_direct3d_12_and_vulkan.html
---

Since July 2017 I develop [Vulkan Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/) (VMA) – a C++ library that helps with memory management in games and other applications using Vulkan. But because I deal with both Vulkan and DirectX 12 in my everyday work, I think it’s a good idea to compare them.

This is an article about a very specific topic. It may be useful to you if you are a programmer working with both graphics APIs – Direct3D 12 and Vulkan. These two APIs offer a similar set of features and performance. Both are the new generation, explicit, low-level interfaces to the modern graphics hardware (GPUs), so we could compare them back-to-back to show similarities and differences, e.g. in naming things. For example, `ID3D12CommandQueue::ExecuteCommandLists` function has Vulkan equivalent in form of `vkQueueSubmit` function. However, this article focuses on just one aspect – memory management, which means the rules and limitation of GPU memory allocation and the creation of resources – images (textures, render targets, depth-stencil surfaces etc.) and buffers (vertex buffers, index buffers, constant/uniform buffers etc.) Chapters below describe pretty much all the aspects of memory management that differ between the two APIs.

[**Read full article »**](http://asawicki.info/articles/memory_management_vulkan_direct3d_12.php5)
How many unique CSS properties can a div have 🤔?
Tags: css, codenewbie, webdev
Published: 2019-07-26 21:12:16

---
title: How many unique CSS properties can a div have 🤔?
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/741r9lk79watqu6kf67k.jpg
description: Just how many CSS properties are there? And how can we find it out?
tags: css, codenewbie, webdev
---

There are a lot of CSS properties! But just how can a div have?  Let's find out!

```javascript
const element = document.createElement("div");
let  totalCssProperiesNo = 0;

_.forEach(element, function(e){
   totalCssProperiesNo++
});

console.log(totalCssProperiesNo);

```

You get 522! As of today.

Thanks to JavaScript teacher for his CSS Dictionary book where he ran his code last year and got 415.
Using custom IDs in Lucky
Tags: lucky, crystal
Published: 2019-07-26 21:01:56

---
title: Using custom IDs in Lucky
published: true
description: How to use custom primary key IDs in Lucky with Avram
tags: lucky, crystal
---

If you're using [Lucky](https://www.luckyframework.org/), and you have a schema that's not default, you may need to create a custom primary key.

I had to do this for an app where my primary keys were defined in postgres like `character varying(18)`. Just doing `String` wasn't going to be good enough since Avram defines those as just `text`. Here's how I did it.


```crystal
# src/models/concerns/custom_id.cr
alias CustomID = String

module Avram::Migrator::Columns::PrimaryKeys
  class CustomIDPrimaryKey < Avram::Migrator::Columns::PrimaryKeys::Base
    def initialize(@name)
    end

    def column_type : String
      "character varying(18)"
    end
  end
end

module Avram::Migrator::Columns
  class CustomIDColumn < Avram::Migrator::Columns::Base
    @default : String? = nil

    def initialize(@name, @nilable, @default)
    end

    def column_type
      "character varying(18)"
    end
  end
end

```

Then in my model, I can now do this:

```crystal
# src/models/user.cr
class User < BaseModel
  skip_default_columns
  table do
    primary_key id : CustomID
    column created_on : Time
    column updated_on : Time
  end
end
```
کتاب تحلیلی بر  entity framework core 2
Tags: entityframework, writtenbymohammad, تالیفمحمدقربانی, کتابتحلیلیبرentit
Published: 2019-07-29 09:07:22

---
title: کتاب تحلیلی بر  entity framework core 2
published: true
tags: Entity Framework,written by Mohammad ,تالیف محمد قربانی,کتاب تحلیلی بر entit
canonical_url: https://ghorbani.dev/%da%a9%d8%aa%d8%a7%d8%a8-%d8%aa%d8%ad%d9%84%db%8c%d9%84%db%8c-%d8%a8%d8%b1-entity-framework-core-2/
---

## کتاب تحلیلی بر entity framework core 2

[تحلیلی برEntity FrameWork Core 2](https://ghorbani.dev): آموزش عملی در اعماق Entity FrameWork Core 2/تالیف محمد قربانی

کتاب تحلیلی بر ef core 2 نوشته محمد قربانی – ترجمه ای است از نوشته های اساتید بزرگ در کتاب ها – مقالات و وبلاگهای شخصی آنها که در یک کتاب به صورت کاملا تخصصی جمع اوری شده .

 ![تحلیلی بر Entity FrameWork Core 2](https://ghorbani.dev/wp-content/uploads/2019/07/tahlili-bar-ef-core-243x300.jpg)

تحلیلی بر Entity FrameWork Core 2

 

 

 

تحلیلی برEntity FrameWork Core 2: آموزش عملی در اعماق Entity FrameWork Core 2/تالیف محمد قربانی تحلیلی برEntity FrameWork Core 2: آموزش عملی در اعماق Entity FrameWork Core 2/تالیف محمد قربانی تحلیلی برEntity FrameWork Core 2: آموزش عملی در اعماق Entity FrameWork Core 2/تالیف محمد قربانی تحلیلی برEntity FrameWork Core 2: آموزش عملی در اعماق Entity FrameWork Core 2/تالیف محمد قربانی تحلیلی برEntity FrameWork Core 2: آموزش عملی در اعماق Entity FrameWork Core 2/تالیف محمد قربانی تحلیلی برEntity FrameWork Core 2: آموزش عملی در اعماق Entity FrameWork Core 2/تالیف محمد قربانی

The post [کتاب تحلیلی بر entity framework core 2](https://ghorbani.dev/%da%a9%d8%aa%d8%a7%d8%a8-%d8%aa%d8%ad%d9%84%db%8c%d9%84%db%8c-%d8%a8%d8%b1-entity-framework-core-2/) appeared first on [Mohammad Ghorbani](https://ghorbani.dev).
Asking for review on non-string regular expressions
Tags: showdev, python, regex
Published: 2019-07-26 20:12:59

---
title: Asking for review on non-string regular expressions
published: true
description: It's pretty abstract but I did something with regular expressions and I look for feedback
tags:
  - showdev
  - python
  - regex
---


There is this idea I have and that I want to push forward about "non-string regular expressions". I explained things as I could on the repo.

{% github Xowap/nsre %}

I'm looking for all kinds of feedbacks

- Do you understand what this is?
- Do you see applications for this?
- Does the API look nice?
- What features would you want to see around that?
- What would you want before using this in production?

Thanks!
🎩 JavaScript Enhanced Scss mixins! 🎩 - Intelligent Accessibility with css variables
Tags: codepen, javascript, scss, css
Published: 2019-07-26 19:58:42

Have you ever wanted to pick a background colour and not have to worry if it meets the WCAG 2.0 AAA standard, you want to just do it in scss and never worry about it.

Well now you can.

### Usage
1. drop the 14 lines of mixins into your codebase
2. drop the 68 lines of JavaScript into your codebase 
3. Include the tiny-color js library
4. do this:

``` scss
.test {
    @include colorAuto();
    background-color: #83a787;
    color: #000; // optional
    font-size: 14px; // optional 
}
```


{% codepen https://codepen.io/acronamy/pen/YmGoKv %}

### How it works

Conceptually it uses the same technique as:
{% link https://dev.to/adam_cyclones/javascript-enhanced-scss-mixins-making-css-scopes-5fkm %}

### Bonus tips.
- The chrome color picker has a standards checker built in!
- This is the worlds nicest accessible color library http://clrs.cc/a11y/
Assembly is simple
Tags: assembly, thoughts
Published: 2019-07-26 18:21:26

---
title: Assembly is simple
published: true
description: A quick overview of what Assembly is
tags: #assembly, #thoughts
---

A year ago, while reading a post about security, I came across [Embedded Security CTF](https://microcorruption.com/). It's a game for teaching about reverse engineering. I played a couple of levels and it was actually fun. But what it made me remember is that Assembly is actually simple.

My motivation in learning how to program came from how I wanted to be a hacker. I've read "Hacking: The art of exploitation" from Jon Erickson which encouraged me to widen my knowledge about computers. I've also read "The Shellcoder's Handbook" and "Gray Hat Hacking" and I remember struggling to get past the first part of these books. You have to understand the basics of how programs work and while they did a great job summarizing that, it was just too alien from what I knew. It was actually too basic.

My first languages were C and Python. And while C is a low-level language compared to Python, it still adds a lot of abstractions over Assembly. Functions, variables, looping,... don't exist in Assembly. And my thought process was wrapped around these concepts. It went better after I learned how those abstractions are implemented when the code is translated to machine code.

What I did understand is that, once compiled, your code will actually be a mix of data and instructions (which are special data). Those instructions can be roughly grouped into three categories based on what they do.

## Moving data around
One of the most common instructions `MOV` falls under this category. You actually do that a lot, moving data from a location (memory, storages, registers) to another one. Even when displaying something, you're just moving data to the graphics controller. 

## Compute data
Other instructions like `ADD` and `CMP` do that. While they may involve complex circuits (Like when doing floating point arithmetics), what they do is doing basic operations like addition, division and storing the result somewhere.

## Jumping all over the place
The processor actually executes code in a linear fashion, one instruction after another and there's a register for keeping track of where the next instruction is. By manipulating the value in that register, we can skip over instructions or go back to a previous one. `JMP`, `CALL` and other instructions do that.

That's a very rough overview of what Assembly is. Some assemblers add their own abstractions over it. Assembly is simple, but it can be tedious to write and even read. That's why you have all those abstractions in high-level languages that are closer to how we think instead of how the computer works, making code easier to understand.
What made you quit your job?
Tags: discuss, career
Published: 2019-07-26 17:36:46

---
title: What made you quit your job?
published: true
description: Our industry has a reputation for short employment tenures. What circumstances tipped you over the edge into quitting your job?
tags: discuss, career
---

Our industry has a reputation for short employment tenures. What circumstances tipped you over the edge into quitting your job?