/images/avatar.png

░E░r░i░c░ ░V░l░o░g░

My Samadhi 🧘

这篇文章将会收集自己的内在一些想法,我自己认真正达三摩地是了解了自己内在的矛盾,分裂,麻痹,欲望,害怕,迷信,依赖,暴力。

为了达到三摩地这一状态,也许本身就是和现实分裂,因为现实和自己期待的有落差。所想的是哪里,而现在是这里。

竞争就会导致焦虑,竞争好像一个闭环我们都是在打转,一个模式的重复运作罢了。 :depress

Postgresql Remove Data Tutorial

🗂️ Identifying Your TV Show Data in PostgreSQL

To locate the table where your TV show data is stored in PostgreSQL, follow these steps:

Step 1: List All Tables in the Database 🗃️

  1. Access the PostgreSQL Prompt:

    docker exec -it riven-db psql -U postgres
    
  2. Connect to Your Database:

    \c riven
    
  3. List All Tables:

    Run the following command to view all tables in the current database:

    \dt
    

    This will display a list of tables along with their schema, name, type, and owner.

Step 2: Examine Table Structure 🔍

Once you have a list of tables, examine the structure of each to find the relevant columns for your TV show data.

  1. Describe a Table:

    For example, to see the structure of the tvshows table:

    \d tvshows
    

    This command shows you the columns, their types, and any constraints (like primary keys).

Step 3: Look for Relevant Columns 🔑

When describing a table, look for columns that might contain your TV show data. Common names include:

  • title
  • name
  • show_name
  • description
  • genre

Example Workflow 🛠️

Here’s how the entire process might look:

# Access the PostgreSQL prompt
docker exec -it riven-db psql -U postgres

# Connect to your database
\c riven

# List all tables
\dt

# Describe the 'tvshows' table to see its structure
\d tvshows

Conclusion 🏁

By following these steps, you can identify which table holds your TV show data and what columns are available for querying or deleting. If you find a table that seems relevant but you’re unsure, feel free to share its structure, and I can help you interpret it!


Troubleshooting Command Errors ⚠️

If you encounter issues with the command you entered, here’s how to resolve them:

Step 1: Ensure You Are in the Correct Environment ✅

Make sure you are in the PostgreSQL command prompt (psql). A prompt like riven=# indicates you’re in the right place.

Step 2: Execute the Query Again 🔄

Try running the query again:

SELECT _id FROM "MediaItem" WHERE title ILIKE '%Isekai%';

Step 3: Verify the Output 📊

If the command executes successfully, it should return the _id of any media items that match the title. If there are no results, it will simply return an empty set.


Checking for References to _id = 3944 🔗

You’ve successfully retrieved a list of tables referencing the MediaItem table. Here’s a summary:

Table Name Column Name
Movie _id
Show _id
StreamBlacklistRelation media_item_id
StreamRelation parent_id
Subtitle parent_id
Season _id
Episode _id

Step 1: Query Each Table for _id = 3944 🔍

Run SELECT queries on each of these tables:

  1. Movie:

    SELECT * FROM "Movie" WHERE _id = 3944;
    
  2. Show:

    SELECT * FROM "Show" WHERE _id = 3944;
    
  3. StreamBlacklistRelation:

    SELECT * FROM "StreamBlacklistRelation" WHERE media_item_id = 3944;
    
  4. StreamRelation:

    SELECT * FROM "StreamRelation" WHERE parent_id = 3944;
    
  5. Subtitle:

    SELECT * FROM "Subtitle" WHERE parent_id = 3944;
    
  6. Season:

    SELECT * FROM "Season" WHERE _id = 3944;
    
  7. Episode:

    SELECT * FROM "Episode" WHERE _id = 3944;
    

Step 2: Execute Queries 🏃‍♂️

Run these queries one by one in your PostgreSQL prompt to check for any records associated with _id = 3944.

Step 3: Review Results 📋

  • Check each output to see if there are related records.
  • If a table returns results, it indicates associations with the MediaItem having _id = 3944.

If you need to delete entries, follow these steps:

First, identify which seasons reference this show:

SELECT * FROM "Season" WHERE parent_id = 3944;

Once identified, delete those records:

DELETE FROM "Season" WHERE parent_id = 3944;

Step 3: Delete the Show 🎬

After deleting related seasons, you can delete the show itself:

DELETE FROM "Show" WHERE _id = 3944;

Complete Workflow 🔄

  1. Check for Related Seasons:

    SELECT * FROM "Season" WHERE parent_id = 3944;
    
  2. Delete Related Seasons (if found):

    DELETE FROM "Season" WHERE parent_id = 3944;
    
  3. Delete the Show:

    DELETE FROM "Show" WHERE _id = 3944;
    

Important Considerations ⚠️

  • Backup: Always ensure you have a backup before performing delete operations.
  • Cascade Deletion: Consider setting the foreign key constraint in the Season table to ON DELETE CASCADE for future deletions.

Here’s a more compact version for easy copy and paste:


🐳 Docker Command entering postgresql.

docker exec -it riven-db psql -U postgres

📜 SQL Queries

SELECT _id FROM "MediaItem" WHERE title ILIKE '%Ganbare Doukichan%';
SELECT * FROM "MediaItem" WHERE title ILIKE '%The Lord of the Rings: The Rings of Power%';

Check Parent IDs

\d "Episode"

🔍 Info for Media Item _id = 1314

SELECT * FROM "Movie" WHERE _id = 1314;
SELECT * FROM "StreamBlacklistRelation" WHERE media_item_id = 1314;
SELECT * FROM "StreamRelation" WHERE parent_id = 1314;
SELECT * FROM "Subtitle" WHERE parent_id = 1314;
SELECT * FROM "Show" WHERE _id = 1314;
SELECT * FROM "Season" WHERE parent_id = 1314;
SELECT * FROM "Season" WHERE _id = 1314;
SELECT * FROM "Episode" WHERE parent_id = 1314;

🗑️ Deleting Records

DELETE FROM "Episode" WHERE parent_id IN (SELECT _id FROM "Season" WHERE parent_id = 4156);
DELETE FROM "Season" WHERE parent_id = 4156;
DELETE FROM "Show" WHERE _id = 4156;
DELETE FROM "Movie" WHERE _id = 3384;
DELETE FROM "Subtitle" WHERE parent_id IN (SELECT _id FROM "Season" WHERE parent_id = 4156);
DELETE FROM "StreamRelation" WHERE parent_id = 4156;
DELETE FROM "StreamBlacklistRelation" WHERE media_item_id = 4156;
DELETE FROM "MediaItem" WHERE _id = 4156;

You can easily copy and paste this format! 😊

A Comprehensive Guide to SQLite: Installation, Checking, and Deleting Records

# 📚 SQLite Guide: Installation, Checking, and Deleting Records

## 1. Install SQLite 🛠️

To get started with SQLite, you'll need to install it on your system. Follow these steps:

### For Debian/Ubuntu:

1. **Open Terminal** 🖥️
2. **Update Package List**:
   ```bash
   sudo apt update
  1. Install SQLite:
    sudo apt install sqlite3
    
  2. Verify Installation ✅:
    sqlite3 --version
    

2. Open Your Database 📂

Once SQLite is installed, you can open your database file:

  1. Navigate to the Directory:
    cd ~/appdata/arrr/jellyseerr/db
    
  2. Open SQLite with Your Database:
    sqlite3 db.sqlite3
    

3. Check for Existing Records 🔍

Before deleting any records, it’s good practice to check if they exist.

Run the Following Query:

SELECT media_request.id 
FROM media 
LEFT JOIN media_request ON media.id = media_request.mediaId 
WHERE media.status = 5;

Interpreting the Results:

  • The output will show IDs of media_request records that are linked to media entries with a status of 5.
  • Example Output:
    1
    3
    5
    7
    8
    9
    10
    11
    14
    15
    28
    

4. Delete Records 🗑️

If you confirmed that records exist, you can proceed to delete them.

Run the Following Query:

DELETE FROM media_request 
WHERE id IN (
    SELECT media_request.id 
    FROM media 
    LEFT JOIN media_request ON media.id = media_request.mediaId 
    WHERE media.status = 5
);

5. Confirm Deletion ✔️

After deleting, it’s important to verify that the records have been removed.

Run the Check Again:

SELECT media_request.id 
FROM media 
LEFT JOIN media_request ON media.id = media_request.mediaId 
WHERE media.status = 5;
  • If the result set is empty, the deletion was successful! 🎉

Conclusion 🎈

You have successfully installed SQLite, checked for existing records, and deleted them as needed. If you have more questions or need further assistance, feel free to ask!

Adguard Home Dns on Debian Armbian

Guide to Change DNS for AdGuard Home (192.168.1.5) on Debian/Armbian and Apply to Docker 🐋

Step 1: Configure AdGuard Home DNS Settings 🌐

  1. Access AdGuard Home Dashboard:

    • Open a web browser and go to:
      http://192.168.1.5:3000
  2. Log in to your account.

  3. Navigate to DNS Settings:

    • Go to Settings > DNS settings.
  4. Configure DNS Forwarding:

    • Add public DNS servers (if needed), e.g.,
      • Primary: 8.8.8.8 (Google)
      • Secondary: 1.1.1.1 (Cloudflare)
  5. Save your changes.

Step 2: Change DNS on Debian/Armbian 🖥️

Method 1: Edit /etc/resolv.conf

  1. Open Terminal.
  2. Edit the resolv.conf file:
    sudo nano /etc/resolv.conf
    
  3. Add the following line:
    nameserver 192.168.1.5
    
  4. Save and exit:
    Press CTRL + X, then Y, and hit Enter.

Method 2: Using /etc/network/interfaces:

If using /etc/network/interfaces:

  1. Open Terminal.
  2. Edit the interfaces file:
    sudo nano /etc/network/interfaces
    
  3. Add or modify the DNS setting:
    dns-nameservers 192.168.1.5
    
  4. Save and exit.
  5. Restart networking service:
    sudo systemctl restart networking
    

Step 3: Configure Docker to Use AdGuard Home DNS 🐳

  1. Edit Docker daemon configuration:

    sudo nano /etc/docker/daemon.json
    
  2. Add or modify the following line if you have changed the Docker default folder before:

    {
      "data-root": "/mnt/docker",
      "dns": ["192.168.1.5"]
    }
    
    • Make sure to include the "dns" setting if you want to configure DNS as well.
    • The "data-root": "/mnt/docker" specifies the location where you changed the Docker data directory.
  3. Save and exit:
    Press CTRL + X, then Y, and hit Enter.

    If docker have

  4. Restart Docker:

    sudo systemctl restart docker
    

Step 4: Verify DNS Settings in Docker Containers ✅

  1. Run a test container:
    docker run --rm busybox nslookup google.com
    
  2. Check the output:
    Ensure it shows 192.168.1.5 as the DNS server.

Conclusion 🎉

You have successfully changed the DNS settings for AdGuard Home and applied them to your Debian/Armbian system and Docker! Now enjoy enhanced ad-blocking and DNS filtering!

Guide to Moving the Default /var/lib/docker to Another Directory on Linux

📦 Guide to Moving the Default /var/lib/docker to Another Directory on Linux 1. 🚫 Stop the Docker Service First, stop the Docker service: sudo systemctl stop docker If you see a warning like this: Warning: Stopping docker.service, but it can still be activated by: docker.socket Then stop the Docker socket as well: sudo systemctl stop docker.socket To ensure that the Docker daemon is completely stopped, you can run: docker ps -a If the command does not return any running containers, the daemon is stopped.