teleren/devto huggingface dataset:
⚡️ Lighting blaze file content copying to the Clipboard (Mac) 💻
Tags: mactricks, bash, productivity, terminal
Published: 2020-06-02 02:24:05

---
title: ⚡️ Lighting blaze file content copying to the Clipboard (Mac) 💻
published: true
description: Copying the content of the file from the terminal to your clipboard. 
tags: Mac tricks, bash, productivity, terminal
//cover_image: https://direct_url_to_image.jpg
---

Have you ever tried to copy the content of a file and paste it somewhere else like copying a JSON file and pasting it in some website. When you want to copy a file, we need to open a file and select all the content by command + A (or using the mouse) and copying the content of the file. 

Here is the trick to copy the content directly from the terminal. 

```bash
pbcopy < filename.txt
```

We can simplify the command by adding an alias in our .bashrc file. So, we don't need to type this whole command to copy the content. Open the .bashrc in vim or any other editor of your choice.

```bash
 vim ~/.bashrc
```

Add the below line inside the .bashrc file and save it. 

```bash
alias cc='pbcopy <'
```

Now we need to restart the terminal or run the below command in the terminal to see our alias in action.

```bash
source ~/.bashrc
```

Finally, you can copy the content of the file by using the cc command and this command is local to your machine.

```bash
cc demo.txt
```

Happy Coding 💻. You can find my personal [.bashrc](https://gist.github.com/avinashsivaraman/7858311a4269ac912d72dd7b4a05c140) file which contains a lot of GitHub and npm shortcuts [here](https://gist.github.com/avinashsivaraman/7858311a4269ac912d72dd7b4a05c140). I am really happy to discuss more tips and tricks to improve productivity. Feel free to comment down below ⬇️
Most of my time is not spent on writing code
Tags: writing, tips
Published: 2020-06-02 02:01:01

As some geek that likes to code, the development life cycle is vicious when there isn’t a clear goal or established plan. In an attempt to fix bugs or implement something from documentation, I find myself blindly fixing bugs or just copy-pasting code off the documentation hoping that it will work. Which doesn’t, leading me to an endless loop of trying to find the error and fix it. Blindly coding was what I used to spend most of my time on.

Until I stumbled upon something simple and yet effective, that is planning. With planning, this delicious pie represents how I spend my time when developing a website or a side project.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f4rmvln69hj30ojgaxji.png)

## What is Planning?

For me, it is simply taking a piece of paper and writing out what I am going to develop, how it looks like, and the possible issues that I might face. It is like an artist who sketches on a canvas before drawing the image.

## Why Planning?

Because it is essential to me, being able to write down my thoughts, brainstorming ideas, and have a visual guideline of what I am going to develop forces me to think. Think of the possible issues that I might run into and solutions for it. Also, it brings forward most of the debugging work that I will encounter. All these, are now written down with a pen and paper.

Aim for progress and not perfection. This is what I have learned while having a plan helps you outline what needs to be done it is not perfect. When writing a plan, it does not cover all the issues that we might encounter, which is why we have to adapt the plan as it is being written.

## How to Plan?

Planning is like a puzzle. To gather the pieces, I have to brainstorm and write out all the ideas and possible implementations that are in my head. With the pieces in hand, I will begin to put them together, refining my plans by shifting the pieces around until I feel satisfied. Finally, it is time to assemble, I will start by trying to map out a flow and see if it makes sense.

If the final plan does not make sense, I will refine it until I feel good about it and most of the doubts I have are cleared. This ensures a close to smooth sailing experience when developing, as it potentially irons out most of the errors that might occur. Be it a logic flaw or a data structure model that just doesn’t make sense.

## Conclusion

At the end of the day, we can’t escape from debugging or reading documentation as it is part of the development journey. But I believe that with a plan we can find ways to remove potential obstacles, reducing the time wasted on blindly coding.

What do we do with the time saved? For me, I spend that time debugging some random bug, refactor my code or knock off early and start doing some other things. For you, take that time to relax, learn a new hobby, or just have do something outside of work. Work != life.
Chrome on Docker
Tags: docker, macos, chrome
Published: 2020-06-02 01:56:01

---
title: Chrome on Docker
published: true
description: Do you need access to Chrome only occasionally ? Would you prefer not installing it locally ? If yes, then read on.
tags: docker, macOS, chrome
cover_image: https://ucarecdn.com/3849be4e-3558-42ef-82b4-3a054738b4e1/
canonical_url: https://learnings.desipenguin.com/post/chrome-on-docker/
---

## Background ##

Some days ago, I got a call from someone asking for a solution. Due to global pandemic they were unable to hand over a laptop to new employee. They wanted the new employee to access a certain websites but did not wish to share the passwords.

Their idea : provide access to *already-logged-in* browser to the new person, so they would have access to the sites, but do not need the passwords.

They had considered AWS workspaces - but it is costly. (Finally they got some "Free for a couple of months" deal, and used as their final solution)

I suggested "Chrome in Docker". The conversation ended, but it intrigued me and wanted to try it out myself.

I started with [this](https://github.com/jessfraz/dockerfiles/tree/master/chrome/stable) but it did not work as-is for me. Partially because (I think) the original repo assumes linux host, and I am on macOS. So I had to make some changes.

## Summary of my changes ##

* I included the `chrome.json` in the repo. See details about this file in the Dockerfile comments.
* I had to replace `libpango` with `libpangox` since the original repo is couple years old.
* Removed `talk-plugin` cause I don't need it.
* Created `run.sh`- because the `docker` command becomes too long, and changing a param becomes PITA
* Removed `--device` params because it does not apply to macOS (I think)
* Finally, I needed XServer, which comes with linux but not macOS. Hence `brew cask install xquartz`

## Bit of Troubleshooting ##

Where is the fun if things work in the first attempt ?
I kept getting `Unable to Open XDisplay` error.

To fix the error, I had to set the `ip` as per [this](https://medium.com/@dimitris.kapanidis/running-gui-apps-in-docker-containers-3bd25efa862a)

I created `setxhost.sh` to simplify this. (Originally it was part of `run.sh`)

You can see all my changes in my [git repo](https://github.com/mandarvaze/chrome-on-docker) which contains all my
modification.

The README has detailed instructions to try this on your mac.
I am a software developer starting a blog
Tags: developer, blogging, writing
Published: 2020-06-02 01:47:05

# And you should start one too

Have you ever thought of starting your own blog? I have many times, but I just never got around to it. I blame myself though. It is a classic case of procrastination and being stuck in endless researching on the internet and using it as an excuse not to actually get started.

But today is the day! This will be my first official post! There are a few reasons that have compelled me to finally get started. I would like to highlight these reasons in this, my first post.

## Exposure

Blogging allows you to showcase your skills and projects to the world. Of course, it will take a lot to draw readers to your post, but in my opinion, it’s better to get one person to see your stuff than have no one at all. As a software developer, I have tried my hand at multiple side projects and in the end, I am the only one who knows about it (I am not ashamed of this because I know many other devs have faced this, but that’s for another post). Putting what you have worked on out there into the world through a blog post could help with some exposure. Additionally, persons get to see what you are made of, and that opens the door for opportunities.

## Community Contribution

I am also here so I can give my two cents of the career and the industry as a whole. I would like to give tips and tutorials to beginners. I was once a beginner and I am still learning. I depended a lot on blog posts like these to develop into the professional I am today. There is just always something so real and genuine about someone giving their thoughts and perspective to certain topics. It really helps!

## Online Journal

I would also like to use this online space to document my growth as a developer. I have come a far, far way. I have learned much and I am still learning. I think it would be fun to have a sort of documentation for myself; like I am a project. I have been incremented with many version numbers and build codes, and I just keep getting better! This space will be my Github...or Gitlab!

## Conclusion

It’s important to note as well, money can be made from blogging, however, that should not be the primary motivator, at least when beginning. I, and you should not be sidetracked by this. I plan to thrive in this area. I am definitely not the best writer. I dont even think of myself as an average one, which is one of the reasons why I have been scared to get started. But I know, just like my dev career, practice makes perfect.

Will you join me?
Platform For Online Concerts
Tags: startup, music
Published: 2020-05-30 14:56:56

Amidst the current Covid-19 crisis, the world is suffering from all kinds of problems, but the one I wanted to ask pertains to independent musicians, especially classical musicians, who don't have any gigs now because everything is shut down. Is there a good platform which can provide these arists a great way to share their music with their audience?

Livestreams on Facebook, Instagram don't really work because of bad quality and bad monetization options. YouTube does have a subscription option which could work but it doesn't really make sense just for concerts. How about a per gig kind of deal where people could listen to their favorite artists perform by paying.

Stuff like Patreon, Ko-fi and YouTube's SuperChat etc. definitely helps but I'm thinking more about a dedicated platform for niche audiences - which some of these classical arts could also survive. On Facebook, Instagram etc., there's just too much noise. You can't play a Mozart concert on MTV for the same reason.

Suggestions/ideas are welcome! Stay safe!
My Journey Into Web Dev
Tags: beginners, webdev, career, watercooler
Published: 2020-06-02 01:44:56

I started in April by visiting FreeCodeCamp and got myself through all the Responsive Web Design modules. I had such a good time revisiting HTML and learning CSS that I decided to jump in head first and paid for a front end course on Udemy. 

I consider myself lucky to be employed during the pandemic (I am not currently working in web dev). I was offered time off, and I used that time wisely to start learning. 

Im about to dive into JavaScript. I’ve been down this road before and gave up in the past. Being armed with HTML + CSS knowledge, I feel like I can give this another round in the context of web development. You can say I am motivated by the amount of tools and resources available out there.  

I plan on creating my landing page with what I know so far while going deeper into JS, as well as following my own progress by blogging here. 

Im not great at blogging or even writing for that matter, but this journey is important to me.

I wish everyone health and happiness in your own journeys, see you in the comments 👍🏻
Hello world with Deno
Tags: deno, helloworld, node
Published: 2020-09-07 12:16:54

---
title: Hello world with Deno
published: true
date: 2020-06-02 00:00:00 UTC
tags: Deno,HelloWorld,NodeJS
canonical_url: https://www.loginradius.com/engineering/blog/hello-world-deno/
---

Hello, Deno Deno is a new platform for writing applications using JavaScript and TypeScript. It is based on the V8 JavaScript engine and the Rust. Deno’s lowest level binding layer to the system is tied to promises (called ops). Deno is secure by default, provides first-class…

   
[Read On](https://www.loginradius.com/engineering/blog/hello-world-deno/)
I'm a Microsoft MVP!
Tags: community
Published: 2020-06-03 16:16:45

---
title: I'm a Microsoft MVP!
published: true
date: 2020-06-02 00:00:00 UTC
tags: community
canonical_url: https://www.hardkoded.com/blog/im-microsoft-mvp
---

I'm super excited to share with you that yesterday I have received the [Microsoft MVP Award](https://mvp.microsoft.com/en-US/Overview) for the very first time!

![award](https://raw.githubusercontent.com/kblok/kblok.github.io/master/img/mvp/mvp.png)

I think the timing is perfect. Last year, I prepared a talk called "You can also be a hero". I was able to give that talk twice: At [Age of Mobile](https://ageofmobile.tech/) in Buenos Aires (big thanks to [Esteban](https://twitter.com/Teban3010) and [Leo](https://twitter.com/sebaleoperez)) and [vOpen UY](https://uy.vopen.tech/) (thanks to all the vOpen crew!). This year I will give the English version for the first time at [HolyJS](https://holyjs-piter.ru/en/), Russia!!! (online 😞) and at the [WebConf](https://twitter.com/webconfar) in Córdoba.

I think it's all about that. It's about being little heroes where you are. Did I dream about this award? Yes, sure! But I never worked for the award. I worked for the community, to give back, to be part of this amazing community. I won't talk more about this, that's what the hero talk is about 😜.

I want to thank [Nico Milcoff](https://twitter.com/nmilcoff) for opening this door and guide me through the process, Thank you Nico!

I hope this award opens more doors to keep helping what I consider one of the best communities in the world: The developer's community.
Fixing shortcuts no Eclipse depois de instalar Lombok
Tags: lombok, eclipse, fixing, install
Published: 2020-06-01 23:59:20

Então, acabou de instalar o Lombok no seu IDE predileto e pecerbeu que os shortcuts não estão funcionando como deveriam. Calma, sem pânico, existe uma solução! Saiba que este poste é para você!

Para corrigir esse erro é preciso abrir um projeto ou já ter um aberto. Selecionar a pasta do projeto e na barra de ferramentas, selecionar a opção:  Project > Properties, digite Annotations e selecione/marque essas três opções:
 - Enable project specific settings
 - Enable annotation processing
 - Enable processing in editor

Confira a imagem a seguir (caso a imagem não carregue, recarregue a página, por gentileza): ![Configure Annotations Processing](https://dev-to-uploads.s3.amazonaws.com/i/o7sqnzv1xr7zr2kv4tuf.png)


Pronto!

Caso precise, feche e abra o Eclipse novamente.

Boas codificações!!

![](https://dev-to-uploads.s3.amazonaws.com/i/wi3gomvzunzn751bh7xn.png)
85/100 100daysofcode Flutter
Tags: 100daysofcode
Published: 2020-06-01 23:09:18

day 85/100 of #100daysofcode #Flutter
Learning Flutter , courses Udemy from
@maxedapps

Today learn Auth firebase, implements try catch, something about build context
https://github.com/triyono777/100-days-of-code/blob/master/log.md
Deciding on a FreeBSD partition schema
Tags: freebsd, disks, partitions, ufs
Published: 2020-06-01 23:09:16


Lately, I've been playing around with FreeBSD. I remembered the first few times I had to partition a disk a long time ago. I spent a lot of time researching what other people did and talking with friends about it. 

It is not a complicated process, but because I didn't do it often, I had to re-learn what I've done every time. Now I'm mostly using ZF which kind of makes partitioning a single disk not necessary. But I wanted to write down my notes on partitioning a disk using UFS if I had to do it again.

I'm following the advice in [Absolute FreeBSD, 3rd edition](https://nostarch.com/absfreebsd3), and create the following partitions:

+ `efi`
+ `swap`
+ `dump`
+ `/`
+ `/tmp`
+ `/var`
+ `/usr` (I'm keeping my `home` directory under `/usr`)

I believe that is a solid "classic" partitioning schema that I find useful and clean. And from this base, and depending on the system I'm deploying, I'll add new partitions. For example, a partition for `/database` if I'm running a server dedicated to PostgreSQL.

Anyhow, if you are interested in more detail here is the link:

[https://rderik.com/notes/notes-on-freebsd-ufs-partition-schema/](https://rderik.com/notes/notes-on-freebsd-ufs-partition-schema/)

I would also recommend the book [Absolute FreeBSD, 3rd edition](https://nostarch.com/absfreebsd3), quite enjoyable. I learned a lot from it.
Matlab: getting rid of nested loops
Tags: matlab
Published: 2020-06-02 08:58:51

---
title: Matlab: getting rid of nested loops
published: true
date: 2020-06-01 23:00:00 UTC
tags: matlab
canonical_url: https://www.deanmontgomery.com/2020/06/02/matlab-getting-rid-of-nested-loops/
---

Ever seen matlab code that looks like this? Maybe you are doing a grid search?

```matlab
for x = 1:10
  for y = 1:5
    for z = 1:100
      for t = 1:2
        do_something(x, y, z, t)
      end
    end
  end
end

```

This is pretty nasty, can we make this look better?

How about something like this?

```matlab
params.X = 1:10;
params.Y = [2, 4, 8];

vectorized_parameters = build_vecd_params(params);
N = size(vectorised_parameters, 1);
for x = 1:N
    candidate = get_row_as_struct(params, vectorised_parameters, x);
    do_something(candidate);
end

```

This looks much nicer, we don’t have nested loops and adding a new parameter to loop over is much cleaner.

We can even randomise the looping order pretty easily:

```matlab
N = size(vectorised_parameters, 1);
iteration_order = randperm(N);
for x = 1:N
    idx = iteration_order(x);
    candidate = get_row_as_struct(params, vectorised_parameters, idx);
    do_something(candidate);
end

```

## How it works

We need to create the two functions:

- `build_vecd_params` to create a matrix where each row is a single permutation of all variables we want to loop over
- `get_row_as_struct`: to extract a row of the matrix and give us back a struct we can use to easily access each looping variable

```matlab
function [vectorised_parameters] = build_vecd_params(params)
% params is a struct like
% params.X = 1:10;
% params.Y = [2, 4, 8];

all_ranges = struct2cell(params);
N = numel(all_ranges);
[grid{1:N}] = ndgrid(all_ranges{:});
vectorised_parameters = reshape(cat(N + 1, grid{:}), [], N);
end

function [candidate] = get_row_as_struct(params, vectorised_parameters, idx)
% return a `candidate` permutation of our loop variables
row = vectorised_parameters(idx, :);
fns = fieldnames(params)';
assert(numel(row) == numel(fns)); % sanity check
c = 1;
for fn_ = fns
    fn = char(fn_);
    candidate.(fn) = row(c);
    c = c + 1;
end
assert(c - 1 == numel(row)) % sanity check
end

```

## How to use it

Just copy the two functions above into your matlab file and you’re off to the races.
How to make a browser console log wait until after a page reload
Tags: consolelog, webdev, javascript, nextjs
Published: 2020-06-01 22:45:35

Ever wanted to create a browser console log that persists after a page reloads? Sure, that isn't a problem if you [enable the "preserve log" option](https://stackoverflow.com/questions/5327955/how-to-make-google-chrome-javascript-console-persistent) in your developer console, but hear me out.

Say you have a JavaScript framework with a development server that usually hot-reloads when you update files while the server is running. In the few cases where hot reloading isn't possible and the page has to fully reload, you want to warn your users and explain why this is happening. It'd be nice to just log a warning to the console with `console.warn()`, but the moment it shows up in the console, wouldn't you know, _the page reloads_, and the browser clears it. Even if your user is eagle-eyed enough to _notice_ your warning flash on the screen for a fraction of a second, it certainly isn't there long enough to actually _read_.

You _could_ say that if any of your users don't know where the "preserve log" button is then that's their problem, but you're kinder than that. You'd rather help them fall into [the Pit of Success](https://blog.codinghorror.com/falling-into-the-pit-of-success/).

As it happens, that's [the very issue](https://github.com/vercel/next.js/issues/13070) I ran into the other day when strolling through my favorite open source project, [Next.js](https://nextjs.org/).

In my naïveté, I first tried just moving the `console.warn()` to the line _after_ `window.location.reload()` and crossing my fingers, but that didn't help. I tried googling things like "console log after page reload", but that only gave me instructions for how to turn on "preserve log", which I already knew how to do.

Here's what worked. Where the `console.warn()` statement stood before, I instead saved the text content of the warning to the window's [`sessionStorage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage) in a key called `"consoleWarnAfterReload"`:

```js
sessionStorage.setItem(
  "consoleWarnAfterReload",
  "Dear me, the page had to fully reload!"
);
```

Then, near the top of a file involved in the loading of a new page, I added a few lines that check that same `sessionStorage` key. If the key exists, it logs the contents of the warning to the console and then removes the item from `sessionStorage`:

```js
if (sessionStorage && sessionStorage.getItem("consoleWarnAfterReload")) {
  console.warn(sessionStorage.getItem("consoleWarnAfterReload"));
  sessionStorage.removeItem("consoleWarnAfterReload");
}
```

That did the trick!

---

Know another way to make console logs wait until after a page reloads? Let me know in the discussion below—I'd love to hear about it!
Instalando o Lombok no Eclipse
Tags: lombok, eclipse, install, setup
Published: 2020-06-01 22:41:25

Para instalar o Lombok no Eclipse e [afins](#afins), pode acessar o [site](https://projectlombok.org/setup/eclipse) cujo conteúdo está em inglês ou continuar e fazer o passo-a-passo. É bastante simples:
 - abaixe um lombok.jar (qualquer versão)
 - clique duas vezes no 'lombok.jar' (double-click);

**<u>Caso não abra a tela de instalação</u>:** efetue o comando no terminal ou cmd:  `java -jar lombok-1.16.18.jar`

 - Então irá procurar por um eclipse ou variações do mesmo já instalado; ![versões de eclipse](https://projectlombok.org/img/lombok-installer.png)
 - (Caso não encontre), deverás indicar o caminho da IDE;
 - então: a instalação perguntará em qual eclipse deseja instalar (caso haja mais de um);

E por fim:
- Poderá verificar se o lombok foi instalado ao ver o popup "sobre o Eclipse" ou "about Eclipse", conforme a imagem abaixo: ![about eclipse](https://projectlombok.org/img/eclipse-about.png)
A versão do Lombok estará listada no final do texto de copyright;

***
OBS.:
Fazendo o mesmo procedimento da instalação poderás desinstá-la.

---
<a name="afins">###Caso tenha interesse em conhecer as variações de Eclipse abaixo está algumas mencionadas: </a>
 * MyEclipse
 * Red Hat JBoss Developer Studio
 * JBoss Developer Studio (JBDS)
 * Spring Tools Suite (STS) 

![](https://dev-to-uploads.s3.amazonaws.com/i/xeey9xvwsp6rotwxv3mf.png)



<u>**Veja também**</u>:
 - [Consertando a quebra de atalhos no Eclipse após instalar Lombok](https://dev.to/gilton/fixing-shortcuts-no-eclipse-depois-de-instalar-lombok-2k6i)