Skip to content

Instantly share code, notes, and snippets.

View bearlike's full-sized avatar
🍄
+1UP

Krishnakanth Alagiri bearlike

🍄
+1UP
View GitHub Profile
@bearlike
bearlike / WiFi_AP_Fire_TV_Custom_AP.md
Last active August 31, 2023 05:20
A step-by-step guide to configure a Raspberry Pi 4 as a WiFi AP with DNS blocking capabilities, tailored to overcome hard-coded DNS settings in Fire TV for an ad-free experience.

Raspberry Pi 4 - WiFi Access Point with DNS Blocking and Pi-Hole Integration

This tutorial will guide you through setting up a Raspberry Pi 4 as a WiFi Access Point (AP) and blocking specific DNS servers, using 8.8.8.8 as an example.

Why should you do this?

You're setting up a Raspberry Pi 4 as a WiFi Access Point (AP) to gain more control over your network, specifically to address limitations in your current router. The primary goal is to block specific DNS servers, like 8.8.8.8, which some devices, such as the Fire TV, use by default. By doing so, you aim to prevent these devices from bypassing your preferred DNS settings, which you've configured to block ads using Pi-Hole. This setup ensures a consistent ad-free experience across all devices connected to the AP, even if they have hardcoded DNS settings.

Prerequisites

  • Raspberry Pi 4 (tested) or similar.
@bearlike
bearlike / docs.md
Last active May 27, 2023 21:35
Understanding License types and GitHub CICD

Krishna's 2-cents:

My understanding of GitHub Action Workflow files

As far as I know (and in my opinion), focusing on these below potential inputs should be a good starting point for engineering language models for generating workflow files, not exclusive to GitHub Actions [CI/CD]:

  • Workflow Name: A name for the workflow file, eg., "CI", "test", "deploy".
  • On Events: What (kind of) events trigger the workflow. This could be any events such as 'push', 'pull_request', or a on complex structures, it could be an API call with payloads. But for now, focusing on simpler events, should get the job done.
  • Environment Variables: Any environment variables that the workflow needs.
  • Jobs: A list of jobs that the workflow should run. Imagine, complete a serives of sub-tasks to compete a bigger task. Each job is roughly an object should atleast contain the below:
    • Job Name
@bearlike
bearlike / Nextcloud_update.sh
Last active November 7, 2022 20:37
Manually update Nextcloud (docker) to the latest version
cd /AppData/nextcloud
# Download latest version
sudo wget https://download.nextcloud.com/server/releases/nextcloud-<VERSION>.zip -O /AppData/nextcloud/nextcloud.zip
sudo unzip /AppData/nextcloud/nextcloud.zip
# Stopping container
docker stop nextcloud-app-1
# Backup old files, move apps and old configurations.
@bearlike
bearlike / docker-compose.yml
Created April 9, 2022 09:23
Docker stack for Nextcloud. (Nextcloud + MariaDB)
version: '3'
services:
mariadb:
image: mariadb:10.7.3-focal
restart: always
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- /AppData/nextcloud/mariadb:/var/lib/mysql
environment:
@bearlike
bearlike / fancy_rpi_motd.md
Last active March 23, 2022 21:41
New Fancy MOTD

Fancy MOTD for Raspberry Pi

Demo

Code

#!/bin/bash
# Login MOTD for Raspberry Pi
print_line () {
	for i in {0..50..1}
@bearlike
bearlike / clear_systemd_journal_logs.md
Created March 8, 2022 07:59
Clear Systemd Journal Logs in Ubuntu 20.04

Clear Systemd Journal Logs in Ubuntu 20.04

Systemd has its own logging system called the journal, and the log files are stored in /var/log/journal.

Check current disk usage of journal files

sudo journalctl --disk-usage

Rotate journal files

  • Active journal files will be marked as archived, so that they are never written to in future.
@bearlike
bearlike / docker-compose.yml
Last active March 5, 2022 17:37
Docker stack with Jupyter, MySQL server and PMA configured for quick access.
version: "3.9"
services:
jupyter:
image: jupyter/minimal-notebook
container_name: jupyter
ports:
- "81:8888"
volumes:
- /home/kk/jupyter/notebooks:/home/jovyan/
@bearlike
bearlike / delete_old_file.py
Last active November 27, 2021 12:14
Service script for a TorrentBox to periodically deletes files from a directory.
#!/usr/bin/env python3
# Service script for TorrentBox to periodically deletes files from a directory.
# Use systemctl to init a service.
import os
from datetime import datetime
import logging
logging.basicConfig(filename='delete_service.log',
format='%(asctime)s %(levelname)-8s %(message)s',
datefmt='%d-%m-%Y %H:%M:%S',
@bearlike
bearlike / update.sh
Created October 21, 2021 10:12
For Updating Packages and Portainer (if new version is available)
#!/bin/bash
# For Updating Packages and Portainer
# Tested on Ubuntu 20.04
LATEST="`wget -qO- https://hub.docker.com/v1/repositories/portainer/portainer-ce/tags`"
LATEST=`echo $LATEST | sed "s/{//g" | sed "s/}//g" | sed "s/\"//g" | cut -d ' ' -f2`
RUNNING=`docker inspect "portainer/portainer-ce" | grep Id | sed "s/\"//g" | sed "s/,//g" | tr -s ' ' | cut -d ' ' -f3`
if [ "$RUNNING" != "$LATEST" ];then
@bearlike
bearlike / clean-server.sh
Last active June 2, 2021 10:51
Script to perform system cleaning and freeing cache on my Ubuntu Server 20.04 as a part of routine server maintenance. (Purging unused Docker Objects, APT Packages, etc.)
#!/usr/bin/env bash
# Last Updated June 2, 2020
# Tested on Ubuntu Server 20.04 LTS
# Variables for pretty printing
RED=`tput bold``tput setaf 1` # Red Color
GREEN=`tput bold``tput setaf 2` # Green Color
NC=`tput sgr0` # No Color
BEGIN=$(df /home --output=used | grep -Eo '[0-9]+')