teleren/devto huggingface dataset:
Sentiment Analysis in a Forensic Timeline With Deep Learning
Tags: deeplearning, nlp
Published: 2023-08-27 07:52:23

## 選定理由

Forensic Timeline というニッチ分野におけるIEEE論文。ドメインはセキュリティ系。

Paper: https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9047947
Code: N/A

以前調査した[[Silalahi2023](https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=10007817)]でも引用されている

## 概要

【社会課題】
セキュリティインシデント後のデータ分析で、重要なイベントやアクティビティを効率的に特定することは、フォレンジック調査者にとって時間とコストのかかる作業である。

【技術課題】
ログファイルから取得したイベントを効率的に識別・解析する方法が不足している。特に、どのログメッセージが実際に調査の関心を持つイベントを示しているのかを判断することが難しい。

【提案】
ログメッセージから興味のあるイベントを自動的に抽出するために、コンテキストとコンテンツのアテンションモデルを組み合わせて、ログ内の[アスペクトターム](https://www.anlp.jp/proceedings/annual_meeting/2021/pdf_dir/P3-5.pdf)とその感情値を識別する深層学習技術を提案した。

【効果】
初期テストでは、F1スコアで98.43%、精度で99.64%の高いパフォーマンスが達成された。本技術によってフォレンジック調査の大幅なコスト削減が見込まれる。

## Context and content attention model for forensic timeline

### Overview

![fig2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zfozxeyhq4yj15ivmqeb.png)

全体像を図２に示す。学習ステップは前処理によって正例と負例を含むサンプルを抽出後に、単語埋め込みが行われ、モデルの学習へ使用される。推論ステップではフォレンジック対象のディスクからまず全体のタイムラインが構築され、これに対して学習済みモデルを使用してハイライトすべきイベントが抽出される。

### Preprocessing

![fig3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zj8wzzdujf4ji7oviyyy.png)

ログメッセージの感情値を取得するために、各ログエントリーは別々のエンティティに分割する。ログエントリーによく見られるエンティティには、タイムスタンプ、ホスト名、プロセス名、特定のイベントに関する短い説明がある。図3はログエントリのエンティティ解析プロセスの例である。
解析には[nerlogparser](https://github.com/studiawan/nerlogparser)ツールを使用した。これは、双方向の長期短期記憶という事前学習済みの深層学習モデルを使用して、ログエントリ内の各エンティティを自動的に分割することができる。nerlogparserの出力は、ログファイル内のすべてのレコードのエンティティ名と値を含むJSONファイル、または辞書データ構造で出力される。

### Word Embedding

単語埋め込みはGloveを使用した。長いログは切り詰め、短いログはパディングを実施して、長さを揃えた。

### Model

![fig4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o4sgkziwnr52n7qw9f34.png)

context attentionは図４に示すアーキテクチャである。

![fig5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tvt8y45bp1vso8khf9fn.png)

content attentionは図５に示すアーキテクチャである。

最終的にsoftmax層を通じてポジティブ、ネガティブに対する分布を得る。

### Build Timeline

最初のタイムライン構築には[plaso(旧log2timeline)](https://plaso.readthedocs.io/en/latest/sources/user/index.html)を用いる。検出されたタイムスタンプを用いて時系列でソートされたcsvファイルを得る。
plasoツールによって生成されるCSVファイルには、日付、時刻、ソース、タイプ、説明など、17の事前定義された固定フィールドが含まれる。感情分析では、システムからの特定のイベントの主要なメッセージと説明を含む「説明」フィールドをモデルへのインプットとする。法医学的なタイムラインを構築する際、ログエントリを解析するためにnerlogparserツールは使用しない。タイムラインの視覚化には、[Timesketch](https://github.com/google/timesketch)を使用する。

## Experiment

![tb２](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cu1159s8t8t6ix7dmlkq.png)

Casperオープンデータセットでの比較が表２である。従来手法と比べてもSOTAである。

![fig7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mpo6zpx90safx2035r8t.png)

Timesketchでの表示結果は図７である。青色はアスペクトワードを、赤色はその感情を示している。DFRWS 2009のケースでは、ユーザーが違法なファイル（このケースでは薬のレシピ）を転送した疑いが持たれている。「goatboy」というユーザーがMardi Grasの画像とビデオライブラリのサブスクリプションと引き換えにこの違法な薬のレシピファイルを持っている。
Efficient Data Validation in Nestjs using class-validator: A Quick Guide
Tags: nestjs, backend, webdev
Published: 2023-08-27 07:50:41

Nestjs is a Node.js framework for building efficient server-side apps. It uses TypeScript and integrates class-validator for data validation. To validate DTOs, which define data shapes, you add decorators like `@IsEmail()` or `@IsNotEmpty()` to class properties. For instance, a CreateUserDto class might look like:

```ts
import { IsEmail, IsNotEmpty, IsString } from 'class-validator';

export class CreateUserDto {
  @IsEmail()
  email: string;

  @IsNotEmpty()
  @IsString()
  password: string;

  @IsNotEmpty()
  @IsString()
  name: string;
}
```

To globally apply validation, use the `ValidationPipe` in your `main.ts`:

```ts
import { ValidationPipe } from '@nestjs/common';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.useGlobalPipes(new ValidationPipe());
  await app.listen(3000);
}
bootstrap();
```

For testing, use class-validator's functions like `plainToClass` and `validateSync`. A Jest unit test example:

```ts
import { plainToClass } from 'class-transformer';
import { validateSync } from 'class-validator';
import { CreateUserDto } from './create-user.dto';

describe('CreateUserDto', () => {
  it('should be valid with valid properties', () => {
    const createUserDto = plainToClass(CreateUserDto, {
      email: 'admin@gmail.com',
      password: 'xxxxxxxx',
      name: 'Admin',
    });
    const errors = validateSync(createUserDto);
    expect(errors).toHaveLength(0);
  });

  it('should be invalid with invalid properties', () => {
    const createUserDto = plainToClass(CreateUserDto, {
      email: 'admin@gmail.com',
      password: 'xxxxxxxx',
      name: null,
    });
    const errors = validateSync(createUserDto);
    expect(errors).toHaveLength(1);
    // Check error details...
  });
});
```
Nestjs and class-validator simplify building and testing apps by using decorators to validate data. For more info, see the official Nestjs and class-validator documentation.
Is htmx the way to go?
Tags: htmx, php, webdev, javascript
Published: 2023-08-27 07:50:13

Heard the insightful podcast „Is htmx the way to Go?“ with htmx creator Carson Gross ([@htmx_org](https://twitter.com/htmx_org)) on the changelog podcast.

https://changelog.com/gotime/266

tl;dr: Job market for react is stronger (obviously), but #htmx can enable sweet spot of achieving updates in backend + frontend more quickly (maintainability).

For usage in php, as far as I know: 

- Craft CMS: Sprig https://putyourlightson.com/plugins/sprig
- Laravel: laravel-htmx, but you could also use [Livewire](https://laravel-livewire.com/) (similiar approach)
- TYPO3: Topwire  https://topwire.dev/
- WordPress: htmxpress (WIP) https://2022.vandragt.com/project/introducing-htmxpress-htmx-for-wordpress/
- Symfony Stimulus (similiar approach) https://symfony.com/bundles/StimulusBundle/current/index.html

What else is out there? Have you already used htmx in real world projects? 🤗

Got some replies here:
- https://social.tchncs.de/@mandrasch/110960463917459161
- https://twitter.com/m_andrasch/status/1695704408552599816

Bonus infos: 

- htmx decided to not have a build script like Svelte, to enable easier participation for open development https://htmx.org/essays/no-build-step/

- @t3dotgg also talked about this sweet spot here: 

{% embed https://www.youtube.com/watch?v=NA5Fcgs_viU %}
Automating the installation of Docker on Linux using a shell script
Tags: docker, linux, automation, bash
Published: 2023-08-27 07:44:01

Create a .sh file file by opening your terminal 
```touch docker-auto-install.sh```
after that open the file
```
nano docker-auto-install.sh
```

and Write this code

```
#!/bin/bash

echo "Updating linux...."
sudo apt-get update
echo "Installing ca-certificates curl and gnupg..."
sudo apt-get install ca-certificates curl gnupg
echo "Add Docker's official GPG key:"
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add Docker repository
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

echo "Update package index again to include Docker repository"
apt update

echo "Installing Docker Engine..."
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

echo "Starting and enabling Docker service"
systemctl start docker
systemctl enable docker

echo "Docker installed and started successfully."
```


After complete save this file by `ctrl+s`
and for exit press `ctrl + x`

Make the script executable: chmod +x docker-auto-install.sh
Run the script with root privileges: sudo ./docker-auto-install.sh

[fiverr](https://www.fiverr.com/s/VLr4pB)
Signals vs. Observables: Can One Truly Replace the Other?
Tags: angular, reactivity, signal, rxjs
Published: 2023-08-27 07:37:45

In Angular 16, the introduction of the reactive primitive known as 'signals' served as a significant addition to the developer's toolbox, leading to shifts in established practices. However, this also sparked confusion among many developers. Some hastily began to convert all observables in their applications to signals, while others did the reverse. This analysis seeks to clarify how Angular applications should navigate this new landscape.

## Understanding the Basics
Before diving into the intricacies, let's establish some foundational definitions:

1. **Stream:** A stream is a sequence of asynchronous events or values.
2. **Signal:** As described in the core team's RFC, a signal is a wrapper around a value that is capable of notifying interested consumers when that value changes.

From these definitions, we deduce a critical distinction: while a signal primarily encapsulates a value and can notify subscribers (akin to a stream) about its changes, a stream can represent a sequence of values or even events without an inherent value. Consequently, while every signal has the potential to produce a stream, not all streams are supposed to originate from signals.

## Practical Implications
When it comes to state management, signals excel. They allow us to define an initial value, update it as needed, and have the application seamlessly mirror these adjustments in the template.

However, challenges arise when there's no initial value, or the value is irrelevant. Consider button clicks as an example. Here, there's no "initial click," and the event's value is usually inconsequential. We're primarily interested in the event itself. While traditional JavaScript recommends callbacks for such scenarios, RxJS introduced event streams, enhancing flexibility through operator pipelines. Given this context, signals might not be the best fit. Using them to update values that won't influence outcomes could be seen as misapplying the tool.

## HTTP Requests: A Unique Stream Scenario
HTTP requests are a peculiar kind of stream. They don't begin with an initial value and emit only once. Promises handle this beautifully. At present, Angular employs RxJS for HTTP operations. While future implementations may differ, there's little rationale, as of now, for migrating these to signals. Despite its singular emission, an HTTP request remains a stream, not merely a value wrapper.

## Conclusion
The architecture of contemporary Angular applications is undoubtedly evolving, adding layers of complexity. This places a greater onus on developers and architects, compelling them to select patterns whenever they incorporate reactivity judiciously.
Given the insights provided, when confronted with the choice between signals and observables, consider the nature of the reactive primitive you're aiming to represent. Discern whether you're dealing with a state or an event, and let that guide your decision-making process.
Learning About APIs and Postman: My experience at API101 by Yash Katyan and Maharishi Sinha
Published: 2023-08-27 07:31:19

APIs, which stand for Application Programming Interfaces, are essential for modern software. They let different apps talk and share data easily. I recently attended the "API101" session by experts Yash Katyan and Maharishi Sinha. This session happened on Microsoft Teams and aimed to teach us the basics of APIs and how to use the tool called Postman.


**Introduction to API's and Postman :**

Learning About APIs and Postman Yash Katyan and Maharishi Sinha started by explaining APIs in a simple way. They told us why APIs matter in making software. This made things clear for people like me who are new to this. They talked about how APIs help software parts work together.

Postman, a famous tool for testing and making APIs, got special attention. They showed us how Postman makes working with APIs easier. They took us through its parts and how it helps to send requests and get answers from APIs.


**Unveiling Request and Response :**

Knowing Requests and Answers Knowing how to ask for things (requests) and how to get things back (responses) from APIs is really important. Yash made this clear by breaking down requests and responses. They talked about how requests are made and what answers look like.

**Learning Resources for Further Learning :**

More Learning Resources Yash and Maharishi were kind enough to give us more things to learn after the session. They showed us where to find online lessons, guides, and places to ask questions. This way, we can keep learning about APIs and Postman even after the class.


**Learning Outcomes :**

Looking back, the "API101" session was really helpful. Yash Katyan and Maharishi Sinha knew a lot and shared it well. They made hard things easy to understand. As I keep learning about APIs, I'm excited to see how they can change how software is made and used. I'm thankful I got to be part of API101. I'm ready to use what I learned in the future.

Whether you're just starting or have experience, knowing APIs and tools like Postman is super important in today's tech world.
What's Your Role in Nurturing the Coding Community?
Tags: discuss, career
Published: 2023-08-27 07:00:00

Have you been involved in building coding communities or fostering a positive coding culture within your organization? What insights can you share?

This week we're exploring the experiences of seasoned developers:  their stories, hurdles, and successes. Like what you're reading? Follow the DEVteam for more discussions like this!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Embracing the CodeNewbie Spirit. How Do You Define It?
Tags: discuss, career, codenewbie, beginners
Published: 2023-08-27 07:00:00

Are you just taking your first steps in the world of coding, seeking to carve your path in a new career? Perhaps you're a seasoned tech enthusiast who's now venturing into a whole new language? We want to hear from you!

Share your unique perspective on what being a CodeNewbie signifies to you. Is it the thrill of cracking your first lines of code, the excitement of embarking on a coding career, or the challenge of mastering a fresh programming language? Let us in on your journey, your motivations, and what makes your CodeNewbie experience so special.

Join the conversation and let your voice enrich the vibrant CodeNewbie community!

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
NEST JS ADVANCED SERIES
Published: 2023-08-27 06:13:26

https://www.youtube.com/watch?v=azFo6p4CRIo&list=PLT5Jhb7lgSBO9QxATpVy0xyiMyn1fSCCx


{% embed https://www.youtube.com/embed/azFo6p4CRIo %}
tailwindcss: scroll to div horizontally:
Tags: codepen, tailwindcss, html, css
Published: 2023-08-27 05:55:53

#*HTML Structure:*
The HTML structure defines a simple web page layout with two div elements placed side by side within a flex container. Each div represents a content section and contains a link for scrolling to the other div. The layout is achieved using Tailwind CSS classes and flexbox properties.

#*Div Layout:*
The parent container is given the flex class, which sets up a flexbox layout, allowing its child divs to be displayed side by side.

Each child div is assigned a unique id (e.g., div1 and div2) for targeting with the links.

#*Styling and Positioning:*
The flex-shrink-0 and flex-grow-0 classes prevent the divs from shrinking or growing to fit their content, ensuring they maintain their specified widths.

The bg-red-300 and bg-green-300 classes provide background colors to the divs. You can replace these with your desired colors.

The w-screen and h-screen classes set each div's width and height to match the full viewport size, ensuring the divs cover the entire screen.

The overflow-y-scroll class enables vertical scrolling within each div if the content exceeds the viewport height.

The flex justify-center items-center flex-col classes are applied to center the link both vertically and horizontally within each div. The flex-col class stacks the content vertically.

The links within each div are styled using the block text-center text-blue-600 underline classes. They appear as block elements, are centered horizontally, have a blue color, and are underlined for visibility.

#*Interactivity:*
The links within each div use href attributes with values corresponding to the id of the target div. This allows users to click the links to scroll smoothly to the other div.
Customization:

The provided code is a starting point that you can customize to match your design preferences. You can adjust colors, fonts, spacing, and other styling elements to create a unique look for your webpage.
Overall, this HTML and CSS layout showcases the flexibility and power of Tailwind CSS and modern web design techniques. It offers an engaging user experience by enabling seamless navigation between two content sections with centered links for easy interaction.

{% codepen https://codepen.io/sohrabzia/pen/poqgoQq %}
Co-authoring Git commits
Tags: git
Published: 2023-08-27 05:45:23

---
title: Co-authoring Git commits
published: true
description: Sometimes you want to be able to credit others in a single Git commit, and luckily that's possible!
tags: git
cover_image: https://images.unsplash.com/photo-1516321497487-e288fb19713f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2970&q=80
# published_at: 2023-08-27 05:41 +0000
canonical_url: https://cassidoo.co/post/co-author-git
---

Sometimes when I'm pair programming (or if someone's been just super helpful to me), I want to be able to give another developer credit in a commit I make in a Git repo.

There's a way to do this (that is supported in both GitHub and GitLab) from the command line! In your commit, you just have to add this to your commit message:

```
Co-authored-by: name <someemail@example.com>
```

Now, if you don't know that person's email address configured in Git, I personally just run `git log` and then scroll through until I find it (which works well on small teams or when that person has a branch that you can checkout and run this on). You could also get a bit more fancy and run `git show <some commit ID where you know they made the commit> --format=email` to get just their email. Or you can be less fancy and just ask them.

This is fairly easy to do in the various Git clients out there since there's a nice open text box for it, but in case you like to use the command line, this is how you'd write it:

```bash
git commit -m "Regular commit message" -m "Co-authored-by: name <someemail@example.com>"
```

And then, once you push, GitHub (or GitLab or wherever you host your Git projects that have this enabled) will credit that person with the commit alongside you!

![Cassidy and Grady co-committed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5eqbgtpixxl70klbhmo.png)

Happy coding!
NumPy Tutorial #10: Array Split
Tags: datascience, python, beginners, tutorial
Published: 2023-08-27 05:28:41

{% embed https://youtu.be/pKycfUJee0Y %}

Let say If I have an array and I want to split it into two arrays, how can I do that?

## Split

In NumPy, we have a method named `split` to divide an array into multiple arrays. The method requires two arguments, which are the original array, and the number of arrays will be generated. Let see how you can implement it.

Let us create an array
```python
import numpy as np

arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
```

Then, let us create a new variable in which that hold the value of splitted array. Also, print the new variable to see the value
```python
new_arr = np.array_split(arr, 2)

print(new_arr)
```

You will get the following result
```
[array([1, 2, 3, 4, 5]), array([ 6,  7,  8,  9, 10])]
```

You can get each individual arrays by typing the following
```python
print(new_arr[0])
print(new_arr[1])
```

You will get the following output
```
[1 2 3 4 5]
[ 6  7  8  9 10]
```

---

There you go, that is how you can split an array into multiple arrays in NumPy. Thank you for reading, and have a nice day!
Letsencrypt in docker compose mode
Published: 2023-08-27 05:01:49

Example with nginx:
```
version: '3.8'
services:
  certer:
    image: certbot/certbot:latest
    container_name: certer
    working_dir: /srv
    networks:
      - locality
    volumes:
      - /srv/certer/:/etc/letsencrypt/:rw

  nginx:
    image: nginx:latest
    container_name: nginx
    networks:
      - locality
    volumes:
      # letsencrypt
      - /srv/certer/certs/archive:/etc/letsencrypt/archive
      - /srv/certer/certs/live:/etc/letsencrypt/live
      - /srv/certer/certs/www:/etc/letsencrypt/www

      # config
      - /srv/nginx/pwd:/etc/nginx/pwd
      - /srv/nginx/conf.d:/etc/nginx/conf.d
      - /srv/nginx:/srv/nginx:ro

      # web
      - /srv/web/blank:/srv/web/blank
    ports:
      - 443:443
      - 80:80
    command: bash -c "cp -rf /srv/nginx/nginx.conf /etc/nginx/nginx.conf && nginx -g \"daemon off;\" -c /etc/nginx/nginx.conf"
    restart: always

networks:
  locality:
    external: true
```

_Note: If you have no docker network, create it with `docker network create locality` or use your own._

Then, delegate your domain/subdomain to your web-server, and run this command in console:
```
docker compose run --rm certer certonly --webroot --webroot-path /etc/letsencrypt/www -d your_domain.dev && chmod -R 0755 /srv/certer/certs
```

In some situations, you need to reload Nginx config with `docker exec nginx service nginx reload`.

Set cron-script to refresh certs:
```
15 3 * * * docker compose run --rm certer renew --quiet && docker exec nginx service nginx reload
```
Setting Up TDM GCC in Ubuntu
Published: 2023-08-27 04:57:01

Installing GCC on Ubuntu
Remini is a great app for editing photos and enhancing them. You can download [remini AI photo](https://apkslug.com/remini-mod-apk/) enhancer from remiapk.
Start by way of updating the programs list: sudo apt update.
Install the [Capcut APK no watermark](https://apkslug.com/capcut-mod-apk/) build-essential bundle of with the aid of [capcut](https://thecapapk.com/) typing: sudo apt deploy build-essential. ...
To validate that the GCC compiler of Mesotherapy products is correctly installed, use the gcc for --version command which prints the GCC version: gcc --version.
Docker image for puppeteer
Tags: puppeteer, docker, libnss3
Published: 2023-08-27 04:46:07

Dockerfile:

```
FROM node:18

RUN apt-get update \
    && apt-get install -y wget gnupg \
    && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
    && apt-get update \
    && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
      --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*
```

Then, you need to create local docker image:
```
docker build -t node18-ppt .
```

And, then, use it, for example in docker-compose.yml:
```
version: '3.8'
services:
  my_api_with_puppeteer:
    image: node18-ppt
    container_name: my_api_with_puppeteer
    working_dir: /srv/web
    volumes:
      - /srv/web:/srv/web
    command: bash -c "yarn install && yarn start"
    restart: always
```