teleren/devto huggingface dataset:
Automating User and Group Creation with Bash: A Practical Guide
Published: 2024-07-03 21:31:49

As a SysOps engineer, managing user accounts and groups efficiently is a crucial task. Automation through scripting can significantly streamline this process, ensuring consistency and saving time. In this guide, we'll walk through a bash script that automates the creation of users and groups based on a provided text file. This script also sets up home directories, generates random passwords, and securely logs all actions.

## Script Overview

Our script, `create_users.sh`, performs the following tasks:
1. Reads a text file containing usernames and group names.
2. Creates users and personal groups.
3. Assigns users to additional groups.
4. Generates and assigns random passwords.
5. Logs all actions to `/var/log/user_management.log`.
6. Stores passwords securely in `/var/secure/user_passwords.txt`.

Script Breakdown

**Input Validation**:
   ```bash
   if [ $# -ne 1 ]; then
       echo "Usage: $0 <name-of-text-file>"
       exit 1
   fi
   ```

**File and Directory Setup**:
   ```bash
   USER_FILE=$1
   LOG_FILE="/var/log/user_management.log"
   PASSWORD_FILE="/var/secure/user_passwords.txt"

   mkdir -p /var/secure
   touch $PASSWORD_FILE
   chmod 600 $PASSWORD_FILE
   touch $LOG_FILE
   ```

**Logging Function**:
   ```bash
   log_action() {
       echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> $LOG_FILE
   }
   ```

**Reading and Processing the Input File**:
   ```bash
   while IFS=';' read -r username groups; do
       username=$(echo $username | xargs)
       groups=$(echo $groups | xargs)
       [ -z "$username" ] && continue
       ...
   done < $USER_FILE
   ```

 **User and Group Creation**:
   ```bash
   if ! getent group $username > /dev/null; then
       groupadd $username
       log_action "Created group: $username"
   fi
   if ! id -u $username > /dev/null 2>&1; then
       useradd -m -g $username -s /bin/bash $username
       log_action "Created user: $username with personal group: $username"
   fi
   ```

**Assigning Additional Groups**:
   ```bash
   if [ -n "$groups" ]; then
       IFS=',' read -ra ADDITIONAL_GROUPS <<< "$groups"
       for group in "${ADDITIONAL_GROUPS[@]}"; do
           group=$(echo $group | xargs)
           if ! getent group $group > /dev/null; then
               groupadd $group
               log_action "Created group: $group"
           fi
           usermod -aG $group $username
           log_action "Added user $username to group: $group"
       done
   fi
   ```

**Generating and Storing Passwords**:
   ```bash
   PASSWORD=$(openssl rand -base64 12)
   echo "$username:$PASSWORD" | chpasswd
   log_action "Set password for user: $username"
   echo "$username,$PASSWORD" >> $PASSWORD_FILE
   ```

**Conclusion**

This bash script automates the user management process, ensuring efficiency and security. By integrating this script into your system administration routine, you can handle user accounts and groups with ease.

For more resources and to explore internship opportunities, visit [HNG Internship](https://hng.tech/internship) and [HNG Hire](https://hng.tech/hire).
New Rails 7.2: Added Rate Limiting
Tags: rails, changelog
Published: 2024-07-03 21:05:22

Ruby on Rails 7.2 added rate limiting to Action Controller. It's cool and easy to use.

![rate_limit in Rails 7.2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0sfw82qnev4mx1kquvu.png)


What's New?
-----------

Rails now offer built-in rate limiting using Redis and Kredis. This empowers you to control how often a user can act within a given time, putting you in the driver's seat.


Before:
-------

```ruby
# Manually implemented rate limiting
```

After:
------

```ruby
class SessionsController < ApplicationController

  rate_limit to: 10, within: 3.minutes, only: :create

end

class SignupsController < ApplicationController

  rate_limit to: 1000, within: 10.seconds, by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new

end
```

How It Works
------------

1.  **Setup:** Ensure you have Redis and Kredis 1.7.0+.
2.  **Usage:** Add `rate_limit` in your controllers.

Why This Matters
----------------

This feature is great for preventing abuse and managing traffic, and it's also highly flexible. You can customize limits per action and gracefully handle exceeded limits, making it a perfect fit for your needs.

Conclusion
----------

This update makes managing traffic easier. It's straightforward and effective. If you're using Rails, give it a try!

For more details, check out the [official pull request](https://github.com/rails/rails/pull/50490).
an exploration into web 3.0 (without blockchain) for the rest of us... or just me and my imaginary friends
Tags: webdev, javascript, semanticweb, deno
Published: 2024-07-03 21:03:35

As someone you support the ideas like right to repair, sematic web, and consumer driven data governance. I wanted to play around these ideas and expand my skills along the way. This blog will be me sharing my journey of learning and humility. I hope it encourages others to overcome imposter syndrome and fears related to being transparent about make mistakes and being imperfect.

This/I will not be a safe space for, tech-bro/bra elitist culture, theocrats, toxic masculinity grifters, genderism, anti-trans/queer, ethnic/white supremacists of any sort, and traitorous king lovers/worshipers who claim loyalty to the USA constitution... fuck you... fuck you all.

Inclusive & and democracy loving geeks/nerds otherwise welcome.

Initial idea for my tech stack 
- deno.js & deno-fresh 
- solid-pods - user data
- gun.js - main DB 
- couchDB - if needed maybe? 

Idea 1: create a pwa based family of apps to improve the experience of a tech job seeker in this job market... if at all possible.

This is just the ramblings of a none expert. I don't want to contribute to the JavaScript tribal fights/wars. My ideas are not the best for anything worth fighting about.

stay tuned.

Reminder, no one has to be perfect to be worthy of compassion and grace. Have great day.
//build_space
Published: 2024-06-15 19:59:07

i have to build something in 6 weeks....

i was thinking as linkdin have became a place of filth where people brag about stuff which is quite literally un-braggable so why not make a community for people to rant out their problem with people on linkdin....

ik its not that good so i was thinking on making the user login system like sage ai... mixing ai with making the profile of a person is so fkin awesome

making a community for devs in not a new idea and has been made by millions of people (maybe) so to it needs a usp (need to think on that)

also making a site for people to rant about is also not new (hello twitter)
and yes making a site for people who can rant about other people while being anonyms is also not a new thing and iirc the last company which made such a product like this was sued (the anonymous users were not really anonymous lol) so i need to think of something else

(i will figure that out as i build this thing i do have 44 days lmao)



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8mflog3sg20clyoxn9fl.png)
New in Rails 7.2: Active Model Got type_for_attribute
Tags: rails, changelog
Published: 2024-07-03 20:42:56

## What's New?

Ruby on Rails 7.2 brings a handy change. The `type_for_attribute` method is now in Active Model.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilmccorzumrcqr8nxvre.png)

## What is type_for_attribute?

It's a method that simplifies type checking, relieving you from the burden of manual checks for both Active Record and Active Model.

## How it Works

Here is a simple example:

```ruby

class MyModel

  include ActiveModel::Attributes

  attribute :my_attribute, :integer

end

MyModel.type_for_attribute(:my_attribute) # => #<ActiveModel::Type::Integer ...>
```

## Real-Life Example

Think of a signup form. You need to check the types of inputs. Here is how you can use it:

```ruby
class SignupForm

  include ActiveModel::Attributes

  attribute :email, :string

  attribute :age, :integer

  def initialize(params)

    @params = params

    @params.each do |key, value|

      if self.class.type_for_attribute(key.to_sym)

        send("#{key}=", value)

      else

        raise "Unknown attribute type"

      end

    end

  end

end

form = SignupForm.new(email: "test@example.com", age: "twenty")

# raises "Unknown attribute type" if age is not an integer
```

## Before the Change

Before this update, you had to write custom code. You had to check types manually.

## After the Change

Now, `type_for_attribute` makes it easy and saves you valuable time. Just include `ActiveModel::Attributes`. It makes your code cleaner and your development process more efficient.

## Why It Matters

This change empowers you to catch errors, ensures data integrity, and is a small but powerful tool that puts you in control of your code.

## In Summary

Ruby on Rails 7.2 simplifies type checking. Use `type_for_attribute` with the Active Model. It's quick and efficient. This change is a great addition. Give it a try in your next project!
Beginner's Guide to Front-End Development: Building the Web of Tomorrow
Tags: webdev, beginners, tutorial, devops
Published: 2024-07-03 20:26:50

Front-end development is the art of creating beautiful and interactive websites. Whether you're a complete beginner or have some coding experience, this guide will walk you through the essential steps to kickstart your journey as a front-end developer.

1. Understanding the Basics: HTML, CSS, and JavaScript
To build a strong foundation, start by learning HTML, the language that structures web content. Next, dive into CSS to add style and design to your web pages. Then, explore JavaScript to bring interactivity and functionality to your creations.

2. Tools and Resources:
Discover the various tools and resources that can enhance your front-end development workflow. From text editors and code editors to browser developer tools, find out which ones suit your needs and make your coding process more efficient.

3. Responsive Web Design:
Learn the principles of responsive web design, which ensures that your websites adapt and look great on different devices and screen sizes. Explore media queries, flexible layouts, and mobile-first design to create user-friendly experiences.

4. Front-End Frameworks and Libraries:
Discover popular front-end frameworks and libraries like Bootstrap, React, and Vue.js. These frameworks provide pre-built components and optimized code to speed up your development process.

5. Version Control and Collaboration:
Learn about version control systems like Git and platforms like GitHub. All these tools allow you to track changes, collaborate with others, and manage your codebase effectively.

6. Accessibility and Performance Optimization:
Understand the importance of creating accessible websites that can be used by everyone, regardless of their abilities. Learn techniques to optimize performance, such as minification, caching, and image optimization.

7. Building Real-World Projects:
Put your skills into practice by building real-world projects. Start with small projects and gradually take on more complex ones. This hands-on experience will solidify your knowledge and showcase your abilities to potential employers or clients.

Front-end development is an exciting field that combines creativity and technical skills. By following this guide and continuously learning and practicing, you'll be well on your way to becoming a skilled front-end developer. Embrace the challenges, stay curious, and enjoy the journey of building the web of tomorrow!

I hope this article helps you kickstart your front-end development journey. Happy coding! 🚀💻
New in Rails 7.2: Generated With .devcontainer
Tags: rails, changelog
Published: 2024-07-03 20:23:35

Exciting news from Rails! The latest Rails 7.2 has a new feature. When you create a new app, it now generates a `.devcontainer` folder.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u76j5e4876kxiv4iz2nk.png)

What's in the `.devcontainer`?
----------------------------

This folder has everything. It helps you start and work on your app. It's made for remote containers. Here's what's inside:

1.  **Redis container**: For Kredis and ActionCable.
2.  **Database**: You can choose SQLite, Postgres, MySQL, or MariaDB.
3.  **Headless Chrome container**: For system tests.
4.  **Active Storage**: Uses local disk and preview features.

Why is this cool?
-----------------

This feature is a time-saver, making the setup process a breeze. You get all you need in one go, which is great for development. Everything is ready to use - no more manual setup.

Skipping parts
--------------

Don't need some of these? No problem! With the `--skip-devcontainer` option, you have the power to skip what you don't need. You choose what's best for your app, putting you in control of your development process.

Who benefits?
-------------

Whether you're new to Rails or a seasoned developer, this feature is designed to make your life easier. If you're new, it will help you start faster. If you're experienced, it will save you time. It's all about making your life easier, no matter your level of expertise.

Real-world use
--------------

Imagine you're building a new app. You don't want to set up each part. Rails 7.2 does it for you. You get Redis, a database, Chrome, and storage ready. Start coding right away. Focus on what matters. Less setup, more development.

Simple yet powerful
-------------------

Rails 7.2 keeps it simple. Yet, it's powerful. This feature shows that. It's designed to make work easier. Whether you're a newbie or a pro, this helps.

### How to use it

Create a new Rails app. Rails adds the .devcontainer. Need to skip it? Just add `--skip-devcontainer`. You're in control.

In summary
----------

Rails 7.2 brings a handy feature. The .devcontainer folder has all you need. It's easy to set up and ready to go. Skip what you don't need. It's simple, fast, and powerful - perfect for all developers.

This update is exciting. It's a small change, but it makes a significant impact. Enjoy coding with Rails 7.2!

Happy coding!
MVP: The best Tech Stack
Tags: startup, learning
Published: 2024-07-03 19:45:50

In todays blog post, I talk about the best tech stack for developing a Minimum Viable Product (MVP). It is a highly opinionated post based on my experience founding two startups and working with many more.

The focus of an MVP is to validate ideas with minimal effort and time. I emphasize using technologies that the development team is already familiar with to ensure rapid development and iteration. I discuss typical MVP team structures, ideal architectural choices like simple client-server models, and advise against complex architectures like microservices for MVPs.

Testing strategies should prioritize functional tests and employ a pragmatic approach. Cloud computing is recommended for deployment due to its scalability and cost-efficiency. Moving from MVP to a maintainable product involves strategies like rewriting, refactoring, or incremental replacement using patterns like Strangler Fig. The key takeaway is that the MVP phase is about speed and validation, setting the foundation for a more robust product later.

For more detailed insights, you can read the full post in [German](https://www.raphaeldumhart.at/blog/mvp-der-beste-tech-stack/).

Disclaimer: This post was partly created with AI for summary and translation.
Avoid Candidates Who Hide Details
Tags: startup, leadership, tutorial
Published: 2024-07-03 19:27:04

Understanding how a candidate plans to work is crucial when hiring remote workers. Have you ever encountered a candidate who hesitates to share their work methods, perhaps citing:

> I'm not a free consultant

While it may sound witty, it's a red flag. Here's why.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9b4ritbvzwpywooylwn.png)

Fear of Intellectual Theft? Not a Valid Excuse
----------------------------------------------

1.  **Standard Methods**: Most strategies are out there for all to see. They're not secrets. If candidates fear sharing, they may not know the methods at all.
2.  **Prove Your Worth**: Sharing ideas shows they know their stuff. Why trust them to do it if they can't explain what they will do?

Personal Traits? Not a Good Reason
----------------------------------

1.  **Team Player Needed**: How will they work with your team if they won't share now? You need someone who can explain their work clearly.
2.  **Openness Matters**: A good worker should be open and transparent. Hidden methods mean hidden problems later.

Creating Trust in Interviews
----------------------------

1.  **Open Discussion**: Good candidates talk freely about their work. It shows they trust you and understand your needs.
2.  **Show Their Skills**: When they share, they show their skills. They prove they can turn plans into reality.

Conclusion: Look for Openness
-----------------------------

Don't ignore the red flags. A great candidate shares their methods. They show they are ready to work with you. They prove they can get the job done. Keep this in mind when you hire. By prioritizing open and transparent people, you can take control of your hiring process and ensure the best fit for your team.

> Hiring the right person is vital. Ensure they show you how they will work and prove they know. This is not just about their methods but their ability to turn their plans into reality, giving you confidence in your hiring decisions.
Front End Technologies
Published: 2024-07-03 19:08:07


Front end development is all about creating the part of a website or a software application that users see and interact with, in simple terms the visual aesthetics for example animations,buttons and more.
Today I shall take you through essential technologies that help achieve front end development.

First is Hyper markup Language(HTML). HTML provides structure and content of web pages. It is considered the skeleton of a website, HTML by itself in my opinion is ugly that is where we go into the second technology known as Cascading Style Sheets(CSS).
Do you remember how I said HTML is ugly? CSS is meant to change this by styling HTML elements by adding colors,fonts and cool animations and layouts. Good luck centering that div.
The third technology is Javascript. Javascript is a versatile language used for addind interactivity to web pages. You will definitely pull your hair once in a while trying to understand Javascript under the hood.
The fourth technology is responsive design. It enables us to create websiites that adapt to different screen sizes for smooth viewing experience.
Finally we have Front end frameworks and libraries that provide reusable components.
if you are wondering how to learn how to use the technologies like a pro check out HNG
[HNG INTERNSIP PROGRAMME](https://hng.tech/internship)
[HNG CAREERS](https://hng.tech/hire)
Colorado Yurts
Tags: marketing
Published: 2024-07-03 19:06:40

[Colorado Yurt](url) is a company that specializes in crafting high-quality yurts, tipis, and tents. With a focus on durability, craftsmanship, and customization, they provide unique and versatile structures for various uses, from glamping and outdoor adventures to residential and commercial purposes. Their products are designed to withstand diverse weather conditions, offering comfort and style in any setting. Colorado Yurt is committed to sustainability and customer satisfaction, ensuring each structure meets the specific needs and preferences of their clients.
[](url)https://coloradoyurt.com/
How to connect to a SQL Server database
Tags: sql, sqlserver, devart, dbforge
Published: 2024-07-03 17:54:55

Working with multiple databases is quick and easy with dbForge Studio for SQL Server, a feature-rich Integrated Development Environment (IDE) for SQL Server and Azure SQL databases. Its capabilities make it simple to connect to databases using a variety of authentication techniques and to manage existing connections effectively.

Learn more: https://www.devart.com/dbforge/sql/studio/connecting-to-sql-server-database.html
T-Shirt manufacturer in ludhiana
Published: 2024-07-03 17:49:14


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enlztu8l6c37682evstz.png)
Nestled in the vibrant industrial hub of Ludhiana, our T-shirt manufacturing in Ludhiana, company prides itself on blending quality craftsmanship with innovative design. Leveraging state-of-the-art technology and a skilled workforce, we produce an array of T-shirts that cater to diverse styles and preferences. Our commitment to excellence is reflected in the superior fabric, impeccable stitching, and enduring comfort of each garment. With a focus on sustainability and ethical production practices, we aim to set new standards in the textile industry, ensuring our customers receive nothing but the best. Whether you're looking for casual everyday wear or custom-branded apparel, our Ludhiana-based manufacturing facility is equipped to meet all your T-shirt needs. T-shirt manufacturer in Ludhiana.

https://posts.gle/1qNbPi
https://vaibhavadventure.com/collar-tshirt-manufacturer.html
https://g.page/r/Cf9n3VKORQTrEBM
Heat.js - Generate customizable heat maps, charts, and statistics to visualize date-based activity and trends
Published: 2024-07-03 17:54:34

Hello!

This is my latest project that I'm trying to spread the word on.  This has been rewritten in TypeScript to allow greater integration support with React, Angular, and other libraries!

Website:
https://william-troup.com/heat-js/

Repository!
https://github.com/williamtroup/Heat.js
𝐂𝐫𝐞𝐚𝐭𝐢𝐧𝐠 𝐚 𝐜𝐲𝐛𝐞𝐫𝐬𝐞𝐜𝐮𝐫𝐢𝐭𝐲 𝐬𝐭𝐫𝐚𝐭𝐞𝐠𝐲 𝐟𝐨𝐫 𝐲𝐨𝐮𝐫 𝐛𝐮𝐬𝐢𝐧𝐞𝐬𝐬: 𝐤𝐞𝐲 𝐬𝐭𝐚𝐠𝐞𝐬 𝐚𝐧𝐝 𝐫𝐞𝐜𝐨𝐦𝐦𝐞𝐧𝐝𝐚𝐭𝐢𝐨𝐧𝐬 🔒
Tags: cybersecurity, security
Published: 2024-07-03 17:46:47

In today's digital world, data protection is becoming a necessity for any business, including small and medium enterprises. Regular incidents of security breaches and data leaks underscore the importance of a thoughtful approach to cybersecurity. Here are several key steps that will help you develop an effective cybersecurity strategy:

1.    𝐓𝐡𝐫𝐞𝐚𝐭 𝐚𝐧𝐝 𝐕𝐮𝐥𝐧𝐞𝐫𝐚𝐛𝐢𝐥𝐢𝐭𝐲 𝐀𝐬𝐬𝐞𝐬𝐬𝐦𝐞𝐧𝐭: Start with a comprehensive analysis of your business's current cybersecurity. Identify the main threats and vulnerabilities you face, along with their potential implications for your operations.

2.    𝐒𝐞𝐜𝐮𝐫𝐢𝐭𝐲 𝐏𝐨𝐥𝐢𝐜𝐲 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭: Establish clear and understandable rules and procedures regarding data protection and information security. Include policies for using complex passwords, regularly updating software, implementing multi-factor authentication, and other basic measures.

3.    𝐄𝐦𝐩𝐥𝐨𝐲𝐞𝐞 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠: Organize training sessions for your staff on the fundamentals of cybersecurity. Training should cover social engineering threats, email security practices, basics of safe internet browsing, and more.

4.    𝐑𝐞𝐠𝐮𝐥𝐚𝐫 𝐀𝐮𝐝𝐢𝐭𝐢𝐧𝐠 𝐚𝐧𝐝 𝐌𝐨𝐧𝐢𝐭𝐨𝐫𝐢𝐧𝐠: Set up processes for regular cybersecurity audits and system monitoring. This will help identify potential issues early on and prevent security incidents.

5.    𝐂𝐮𝐬𝐭𝐨𝐦𝐞𝐫 𝐃𝐚𝐭𝐚 𝐏𝐫𝐨𝐭𝐞𝐜𝐭𝐢𝐨𝐧: Ensure the protection of customer data in accordance with applicable legislative requirements (e.g., GDPR) to avoid breaches and maintain trust.

6.    𝐈𝐧𝐜𝐢𝐝𝐞𝐧𝐭 𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐞: Develop an incident response plan that includes steps for quick detection, analysis, and resolution of security incidents.

These steps will help strengthen your business's cybersecurity and protect it from potential threats. Investing in data protection is not only a commitment to your customers but also a strategic decision that contributes to the long-term sustainability and success of your business.

Share your thoughts and experiences in the comments! What data protection measures have you already implemented in your business? 💬