teleren/devto huggingface dataset:
TIL - Unix shells have a $RANDOM env variable
Tags: unix, sh, bash, zsh
Published: 2019-04-09 21:23:43

---
title: TIL - Unix shells have a $RANDOM env variable
published: true
description: 
tags: unix, sh, bash, zsh
---

Ever wanted to add some randomness to your shell script? No I don't mean to make them flaky! 

Unix shells provide a `$RANDOM` environment variable that we can use in our shell commands or scripts:

```
% echo $RANDOM 
21290
% echo $RANDOM
8367
```

The _seed_ for the random number generator can be changed as follows:

```
% RANDOM=12345
% echo $RANDOM
5758
```

### Generating random numbers in a range

We can use `awk` for generating random integers in a given range. For example, to generate a random number between 1 and 10 (inclusive):

```
% awk -v seed=$RANDOM 'BEGIN{srand(seed); print int(rand()*10+1)}'
10
% awk -v seed=$RANDOM 'BEGIN{srand(seed); print int(rand()*10+1)}'
4
% awk -v seed=$RANDOM 'BEGIN{srand(seed); print int(rand()*10+1)}'
1
```

#### More details at:
- http://srufaculty.sru.edu/david.dailey/unix/random_numbers.htm
Returning a Zip File from ASP.NET MVC Action - in Pure .NET
Tags: dotnet, aspnet
Published: 2019-04-09 20:59:03

---
title: Returning a Zip File from ASP.NET MVC Action - in Pure .NET
published: true
description: how to generate Zip files on the fly in native C#
tags: #dotnet #aspnet
canonical_url: https://www.jitbit.com/alexblog/278-returning-a-zip-file-from-aspnet-mvc-actions---in-pure-net/
cover_image: https://i.imgur.com/qVm1v6L.png
---

If you search for "generate zip in ASP.NET/C#" you get tons of blog posts and StackOverflow answers suggesting DotNetZip, SharpZipLib and other 3rd party libraries. And up until now that was the only solution.

But .NET Framework 4.5 and later (finally) includes native tools for working with Zip archives - `ZipArchive` class from the `System.IO.Compressions` namespace.

Here's an example of how you can dynamically generate a zip file inside an ASP.NET MVC action method (comes handy if you want to return multiple files within one response, for example):

```csharp
public ActionResult GetFile()
{
    using (var ms = new MemoryStream())
    {
        using (var archive = new Compression.ZipArchive(ms, ZipArchiveMode.Create, true))
        {
            byte[] bytes1 = GetImage1Bytes();
            byte[] bytes2 = GetImage2Bytes();

            var zipArchiveEntry = archive.CreateEntry("image1.png", CompressionLevel.Fastest);
            using (var zipStream = zipArchiveEntry.Open())
            {
                zipStream.Write(bytes1, 0, bytes1.Length);
            }

            var zipArchiveEntry2 = archive.CreateEntry("image2.png", CompressionLevel.Fastest);
            using (var zipStream = zipArchiveEntry2.Open())
            {
                zipStream.Write(bytes2, 0, bytes2.Length);
            }
        }
        return File(ms.ToArray(), "application/zip", "Images.zip");
    }
}
```


I've just added two images files (in a form of byte arrays) into one zip-archive and returned it to the user. `GetImage1Bytes` and `GetImage2Bytes` are simply stubs for your code here. Nice and easy. But the best part - you're not using any external dependencies, all pure .NET.
Custom binstub for Rubocop to run only on changed files
Tags: ruby, rails, rubocop
Published: 2019-04-09 20:53:27

Salud to Dev.to community! A couple of weeks back I have posted first time here in `Dev.to`, motivating myself to post articles about Ruby, Rails, Javascript and Development in general.

Today's short write up will be to run Rubocop only on changed files and creating binstubs.

When starting a project, setting up and following style guides is pretty easy. However, when we inherit a legacy codebase or try to apply them on already existing medium to large scale applications, we quickly get frustrated as there are already hundreds if not thousands of failures that we have to fix.

A better way to do this is to progressively run robocop as we continue with our development. Each time you touch part of your codebase, Rubocop will only analyze and lint the given changed files.

So, let's start.

First, we will have to create a custom `binstub` to run Rubocop instead of default `rubocop` command. Then we will be writing logic inside the `binstub` to find changed files using `git` and apply `robocop` on them.(Aneeta has a handy article about this [here](https://medium.com/devnetwork/running-rubocop-only-on-modified-files-a21aed86e06d))

To create a `binstub` Bundler provides `bundler --binstubs gemname` but we will not need any of the boilerplate, so let's just create an empty file named `rubocop` in our `bin/` directory.

Once, we have created the file, we will have to write logic to compare current changes to the master branch(or the branch of your choice) as below:

```ruby
#!/usr/bin/env ruby
# frozen_string_literal: true

class RubocopRunner
  COMPARE_TO_BRANCH = 'master'
  def self.check_branch_validity
    current_branch = `git branch | grep \\* | cut -d ' ' -f2`.strip
    if current_branch.empty? || current_branch == COMPARE_TO_BRANCH
      puts "No git found, or you are still on #{COMPARE_TO_BRANCH} branch."
      exit 0
    end
  end

  def self.check_non_committed_changes
    system("git ls-files -m | xargs ls -1 2>/dev/null | grep '\.rb$' | xargs bundle exec rubocop #{ARGV.join(' ')}")
  end

  def self.check_committed_changes
    system("git diff-tree -r --no-commit-id --name-only head origin/master | xargs bundle exec rubocop #{ARGV.join(' ')}")
  end
end

RubocopRunner.check_branch_validity
RubocopRunner.check_non_committed_changes
RubocopRunner.check_committed_changes
```

Now we can run `bundle exec bin/rubocop` and see it only apply on changed files. And don't forget to add your `.rubocop.yml` configuration file to root directory of your project. 

Hope it helps, and let me know if there is anything that does not work as expected!

See you soon!
3 tips for delivering more value
Tags: podcast, value, career, productivity
Published: 2019-04-09 20:34:27

---
title: 3 tips for delivering more value
published: true
description: A question I was asked on "Developer on Fire"
tags: podcast, value, career, productivity
cover_image: https://thepracticaldev.s3.amazonaws.com/i/9n03la2xrb933gneak4n.jpg
---

On a recent "Developer on Fire" podcast with [Dave Rael](https://twitter.com/raelyard), I was caught a bit off guard with the question: "Provide three tips for delivering more value". That was it. It was left completely open as to what it meant. 

First off, clearly you should listen to the whole podcast for the most value! 😂  Failing that, I thought I'd write up my answers here, to let you gauge how I did.

{% podcast https://dev.to/developeronfire/episode-418-edaqa-mortoray-whole-humans-programming %}


## 1. Know who your user is

If you've been following my writing, you won't be surprised by this answer. It's something I've been [harping on](https://medium.com/mortoray/the-user-7dd548dfb938)  a lot lately. The user isn't some person banging on a keyboard, it's the person taking the train, or trying to organize a party on the weekend.

Users exist in the real world. They're actual people, not mindless consumers nor button pressing automatons. The software you right is only a tool to them.

Learning to understand [who your users are](https://skl.sh/2HJdiyk), will give you a huge value advantage in your programming career.


## 2. Take care of yourself

It's easy to say, but harder to follow through on. I've unfortunately seen what happens when people neglect themselves. I've seen frustration, tension, and burnout. You'll suffer, the company will suffer, and the product will suffer.

You are the foundation of the work you do. Your work will deteriorate as you yourself start to slip. 

Taking care of yourself is an absolute requirement to putting out quality work. If you're interested in taking the first step, read [my article on easy programmer fitness](https://simpleprogrammer.com/programmers-improve-fitness/) over at Simple Programmer.


## 3. Just try it

You won't know if you're good at something, or whether you like something, until you try it. 

For example, I have no idea how to promote [a book](https://geni.us/WhatIsProgramming), but I wouldn't of known that if I didn't have a book to promote. It's forcing me to learn new things, and giving me new experiences.

Try new things, in your career, out of your career. Go out and try it. Who cares if there are other people doing it better -- that's always going to be the case. Just try the things you like and want to experiment on.

Trying is the path to learning.


# What do you do to add value?

Let me know what you think of my answers and share with us your own tips for delivering more value.

----

_Image by <a href="https://pixabay.com/users/Free-Photos-242387/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1030846">Free-Photos</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1030846">Pixabay</a>_
Vscode Phpsearch
Tags: php
Published: 2019-04-09 18:42:50

![Phpsearch](https://raw.githubusercontent.com/Alicannklc/Vsocde-Phpsearch/master/images/php.gif)

  [Plugin Url](https://marketplace.visualstudio.com/itemdetails?itemName=alicannklc.PhpSearch)
Open Dev.to from your terminal 🎉
Tags: showdev, python, cli
Published: 2019-04-09 18:32:25

Sometimes when I'm hacking away on my terminal, I like to take a break and read the articles on this awesome community. The [dev.to cli](https://github.com/sarthology/devtocli) is pretty neat, and I highly recommend it. It works great! Try it out if you haven't.

{% link https://dev.to/teamxenox/devto-cli-a-valentines-day-gift-to-my-favorite-people-56bd %}

What I felt would be better for me though, was a scenario where I'd just type in one command and a new Dev.to tab would open on my browser. So I wrote a simple python script to do this. This was extremely simple to do using python's `webbrowser` package.

![python](https://imgs.xkcd.com/comics/python.png)

Then I thought: _"Why not make this a package and share it with everyone?"_, and [that's exactly what I did](https://github.com/wangonya/open-dev.to).

## Installation
Install open-dev.to from [PyPi](https://pypi.org/project/open-dev.to/)
```
pip install open-dev.to
```

## How to use
```
$ dev.to --help
Usage: dev.to [OPTIONS]

  Open a new dev.to browser tab on the browser

Options:
  -t, --tag TEXT  add a tag
  --help          Show this message and exit.

```

### Open home page
```
$ dev.to
```

### Open a tag page
e.g javascript, career, productivity
```
$ dev.to -t javascript
```

Enjoy!

![kitten](https://media.giphy.com/media/3oKIPnAiaMCws8nOsE/giphy.gif)
Auth0 Internal Dev Tools: Unleashing Engineering Potential
Tags: devtools, devops, engineering
Published: 2019-04-09 18:14:02

---
title: Auth0 Internal Dev Tools: Unleashing Engineering Potential
published: true
description: Helping engineers stay focused on building features that solve the hard problems of identity for customers.
tags: #devtools #devops #engineering
canonical_url: https://auth0.com/blog/auth0-internal-dev-tools-unleashing-engineering-potential/
---

We are growing and scaling the organization at a really fast pace, and engineering is no exception. This presents some interesting and fun challenges:

Promoting and developing the culture that fuels this endeavor.
Hiring and retaining great engineers.
Minimizing duplicate work and time to be productive as new people come in.
This blog post is focused on how Auth0 is addressing part of that last challenge; by building a dedicated team to unleash the potential in Auth0 developers to deliver business value with confidence.

[Read on 🛠](https://auth0.com/blog/auth0-internal-dev-tools-unleashing-engineering-potential/?utm_source=dev&utm_medium=sc&utm_campaign=auth0eng_internaltools)
Top 5 DEV Comments from the Past Week
Tags: bestofdev
Published: 2019-04-09 17:55:52

---
title: Top 5 DEV Comments from the Past Week
published: true
description: Highlighting some of the best DEV comments from the past week.
tags: bestofdev
cover_image: https://res.cloudinary.com/practicaldev/image/fetch/s--7VrAA2ln--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://thepracticaldev.s3.amazonaws.com/i/qmb5wkoeywj06pd7p8ku.png
---

This is a weekly roundup of awesome DEV comments that you may have missed.  You are welcome and encouraged to boost posts and comments yourself using the **[#bestofdev](/t/bestofdev)** tag.

Replying to **[My Favorite Teachers In The JavaScript Community](https://dev.to/emmawedekind/my-favorite-teachers-in-the-javascript-community-53h)**, @alemesa adds some more great names to the list:
{% devcomment 9p54 %}

@denmch replied to **[Use $ & $$ Instead of document.querySelector/All in JavaScript without jQuery](https://dev.to/mrahmadawais/use-instead-of-document-queryselector-all-in-javascript-without-jquery-3ef1)** with some additional tips about using trivially longer identifiers:
{% devcomment 9o9n %}

The **[Learning to love software development books 💙](https://dev.to/lightalloy/learning-to-love-software-development-books-5e4)** was a great discussion about learning through books, as opposed to online videos and tutorials.  @lokidev chimed in with some recommendations:
{% devcomment 9pj6 %}

The **[Workspace Wednesday: Show off your desk/computer setup! ](https://dev.to/ben/workspace-wednesday-show-off-your-desk-computer-setup-2di4)** was a fun opportunity to showcase our desks and workspaces.  Plenty of people were liking @steveblue's setup:
{% devcomment 9p15 %}

Finally, in **[CSS Is Hard - How do you learn to use and write CSS properly? ](https://dev.to/antjanus/css-is-hard-how-do-you-learn-to-use-and-write-css-properly-5eka)**, @horus_sky provided a number of tips for learning CSS.  This comment could probably be converted to a great article 😉:
{% devcomment a08e %}

See you next week for more great comments ✌
NASA Astrophysics Data System is hiring a UI/UX developer
Tags: hiring, whoishiring, javascript, ui
Published: 2019-04-09 16:59:47


## About Us
The ADS project is funded by NASA through a cooperative agreement and provides its services to the entire worldwide research community in astronomy and physics. We are hosted by the Smithsonian Astrophysical Observatory at the Harvard-Smithsonian Center for Astrophysics (CfA) in Cambridge, Massachusetts (USA), one the largest and most diverse astrophysical institution in the world. Here, scientists carry out a broad program of research in astronomy, astrophysics, and earth and space sciences. By joining our group, you will be actively supporting the discovery and dissemination of scientific results to the worldwide research community!

## About The Opportunity
We’re looking for a front-end developer interested in designing and implementing key components of the user interface, including user profiles, notifications, and search capabilities. 

Some of the perks of the jobs include:

* Work with a creative, multitalented team in a first-class academic environment
* Generous benefits, flexible work hours, and (local) telecommuting options
* Access to the astronomical community and events at the CfA and Harvard University
* Engage with users at community meetings and present your work at scientific conferences in astronomy and information science 

## How To Apply
You can go [here](https://ui.adsabs.harvard.edu/about/careers/) for more information about the position and where to apply.

## Qualifications
Candidates should have knowledge of JavaScript and Node.js, the ability to create solid, usable user interfaces, and experience with UI/UX design in a technical envrionment


_Please feel free to leave questions in the comments section._
How to capture code snippets on the web and store them securely with just one click?
Tags: codesnippets, dapp, blockstack, encryption
Published: 2019-04-09 16:54:48

---
title: How to capture code snippets on the web and store them securely with just one click?
published: true
description: DECS Extension for Chrome - The best way to capture and manage code snippets on the go
tags: Code snippets, DApp, BlockStack, Encryption
cover_image: https://thepracticaldev.s3.amazonaws.com/i/2sp3l9h3di2c63os1fkz.jpg
---
We all crawl the web in search of code. How many times have we painfully repeated steps to land on that same piece of code again? Wouldn't it be good if you could manage code snippets like these in one place for future reuse?

Now no more copy-pasting into text files or all-purpose notebooks. With DECS browser extension, using single-click, capture the code snippets on the go and store them for future use.

With DECS you can store, secure and tightly control access to proprietary snippets, tokens, configurations, certificates, and other sensitive data all in one workspace. You can also tag, share and sync your curated snippet knowledge base within a team or with the world (public snippets).

Your data is end-to-end encrypted by default and is secure from falling into the wrong hands. Encryption and decryption of snippets (your information) on DECS occur entirely on your device behind the scenes; even we (DECS) cannot see your content.

Give it a try now!
Website - [Check it out](https://app.decs.xyz)
Chrome Extension - [Install now](https://chrome.google.com/webstore/detail/decs-code-snippets - manage/mkclebnkdjjpamialfgieminnkdepbcl)

{% youtube 1goz6YAGI5Q %}
Just Ship It
Tags: jobs, productivity, mentalhealth
Published: 2019-04-09 16:47:43

---
title: Just Ship It
published: true
description: 
tags: jobs,productivity,mental health
---

If you're like me, you've worked on a lot of side projects where your enthusiasm has waned over time as you realize that it's not as niche-filling, interesting, or commercially viable as you originally hoped. I tend to experience this at the 70%-to-MVP mark, and then the project becomes just another directory I move into my `archives` folder.

If you don't have an already-extensive portfolio to show to interviewers or clients, just ship it! Having something is better than having nothing, and you're likely undervaluing the quality of your work. Plus, having deployment experience is incredibly valuable, and being able to DIY your way through the development, implementation, and deployment of a product, even if it's not up to your standards, is a huge confidence-booster!

I've also learned that deploying half-built projects gives me more incentive to work on them (as does publishing half-finished text posts that I can edit over time). It gets you over the hump of self-consciousness and you get something to show for it!

Just ship it!
what is the proper way for api versions
Tags: api, help, web, app
Published: 2019-04-09 16:44:59

---
title: what is the proper way for api versions
published: true
description: i am working on a web project  which pervoide api for its mobile app. I am confused  about  api versioning. Should i copy all apis from version 1 and make new files for version 2 and do my changes in version 2. Please guide me for this. Thanks in advance 
tags: api,help,web,app
---
If I don't use React, am I still a developer?
Tags: react, discuss, career
Published: 2019-04-09 16:37:24

---
title: If I don't use React, am I still a developer?
published: true
description: "A self-taught developer, more confident in his abilities than ever, feels he's just a hack because he doesn't understand anything anymore"
tags: [React, Discuss, Career] 
cover_image: https://bflick.imgix.net/https%3A%2F%2Ffarm8.staticflickr.com%2F7912%2F46509992404_ab8e95335d_k.jpg?w=1200&s=0fb61f3af3f3347d2763489cb520fee8
---

*This post is an excerpt from my [2019 Sunrise Journal](https://bugsy.me/sunrise) (built with Hugo, Imgix, Flickr, and yes, jQuery), which I thought would be interesting to share with the dev community.*

---

I've been a professional web developer for over a decade. But lately there's been a recurring question in my head, "If I don't use React, am I still a developer?"

In one regard, I've never been more confident in my abilities. I can be handed a design and make a functioning site with many of the best practices, tie in API services, and create some advanced functionality. 

It all began with [my first website in 1996](http://bugsy.me/pipeline/4178), learning HTML and CSS on Geocities when I just was just 13 years old. Eventually I learned to make dynamic websites, mastered Wordpress, learned MySQL, managed several WHM servers, fell in love with regular expressions and did so while working for on some incredible projects through a [couple](http://projecttraction.com) [agencies](http://elegantseagulls.com) and have used my knowledge to [launch](http://hit.bugsy.me) [some](http://yooper.singles) [fun](http://beerwithbranson.com) [projects](https://bugsy.me/sunrise).

In another regard, I feel like a complete hack. I've been a casual dev.to reader for a couple years. Now when I read the content, I feel everything is entirely over my head. Being in the remote Upper Peninsula of Michigan, it's difficult to find developers to learn with. I don't relate to a thing I read about the culture of Silicon Valley or the startup scene. Being entirely self-taught I feel basic concepts of programming or development are beyond me. React, ES6, AWS management, node.js, Vue, and package managers are completely beyond me. And worst of all, I still build using jQuery and PHP (it's ok, you can laugh).

This is a field I love, but I feel like an old guy (PHP) in a young guy's game (React).

This leaves me with many questions.

* Just how in the world does one keep up with it all?
* If I don't keep up, will I still be taken seriously as a developer? 
* Is there a place in the dev community for those who are marketers first, and developers second?
* Is becoming full stack out of the question?
* And alas, if I don't use React, am I still a developer?
Dev.to is the Perfect Platform for Mild-Effort Posting
Tags: devto, wordpress, blogging, meta
Published: 2019-04-09 16:34:49

---
title: Dev.to is the Perfect Platform for Mild-Effort Posting
published: true
description: 
tags: dev.to,wordpress,blogging,meta
---

Wordpress, blogspot, ghost, and analogous blogging platforms have always felt to me much more metered, where everything you write is assumed to be drafted and carefully considered. Twitter has decent support for effort-posting but it feels like a hack (drafting threads specifically), and the good writing that comes out of Twitter seems like it exists despite Twitter's design, not because of it. Facebook has the obvious limitation of mostly being an IRL social network, with only mild support for long-form content (FB notes are extremely dead, and long-form content exists behind several read-mores, mixed in with your old high-school friends' selfies).

Dev.to perfectly bridges this gap: it offers a great interface for writing long-form content, while still retaining the trappings of an informal social network. Writing here also feels relatively protected, and not quite as public as writing in other places, due to the cozy community vibes it gives off.

I imagine that writing here will be a perfect place to test-drive ideas for essays and longer posts and to interact with other people putting a similar amount of effort into their writing: enough that it's substantial, but not so much that it's perfectly polished.

All this being said, maybe it's just the monospace font for article drafts?
A contact list of freelancers.
Tags: career
Published: 2019-04-09 16:28:03

---
title: A contact list of freelancers.
published: false
description: What if there are no hurdles between you and your client?
tags: career
published: True
---

![](https://thepracticaldev.s3.amazonaws.com/i/3g72ay6japedd3n3ru71.png)

I am a Ruby on Rails freelancer. Many times when my project expands I need to search for other freelancers, and this annoys me. For the following reasons.

There are many websites that list freelancers, but their contact details are hidden for some reason. This I think is stupid. So I have developed https://nyoboo.com. You can list your contact details in it. Who knows, some one requiring your service might be near your home, in the same town, or in the next street.

I hope my simple listing site helps you and brings you more business.