Skip to content

Instantly share code, notes, and snippets.

source <(grep -v '^#' .env | sed -E 's|^(.+)=(.*)$|: ${\1=\2}; export \1|g')
@phnahes
phnahes / insert_on_line.sh
Created June 1, 2020 00:42
Add script on specific line using bash
awk 'NR==3{print "insert your text here"}1' /etc/config.ini
@phnahes
phnahes / DenyWithoutMFAPresent.json
Last active June 1, 2020 00:43
Deny Aws login Without MFA Present
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"*"
],
"Resource": [
"*"
],
@phnahes
phnahes / SwitchRole.md
Last active May 27, 2020 18:15
How use SwitchRole in Two or more AWS Accounts

AWS Switch Role

Scenario:

  • Source account ID: 123456789 ** Devops Group.

  • Destination account ID: 999999999

How to

@phnahes
phnahes / rpi.gpio
Created April 25, 2020 01:37
Install GPIO packages for RaspberryPi
sudo apt-get update
sudo apt-get install build-essential python-dev python-pip python-setuptools -y
export ARCH=arm
export CROSS_COMPILE=/usr/bin/
pip install rpi.gpio
@phnahes
phnahes / config.txt
Created April 23, 2020 13:10
Configurations for config.txt on RaspberryPi
# Configure HDMI to work on low resolutions for bad monitors
# https://www.raspberrypi.org/documentation/configuration/config-txt/video.md - Session hdmi_mode
hdmi_force_hotplug=1
hdmi_ignore_edid=0xa5000080
config_hdmi_boost=4
hdmi_group=2
hdmi_mode=4
disable_overscan=0
overscan_left=24
@phnahes
phnahes / bcd.bat
Created April 17, 2020 21:45
Clone HDD to SSD and using SSD for Boot and System (UEFI)
# Boot a LiveCD linux and install clonezilla
apt update && apt install clonezilla -y
# Using Gparted, clone partitions in the same type, size and flags from source disk (sda) on target target(sdb)
# After, using clonezilla, clone part_to_part
# sda1 to sdb1
# sda2 to sdb2
# sda3 to sdb3
#
@phnahes
phnahes / windows-serial.bat
Created April 15, 2020 14:23
Find Windows 10 Product Key on a New Computer
# 1- Press Windows key + X
# 2- Click Command Prompt (Admin)
# 3- Type command below:
wmic path SoftwareLicensingService get OA3xOriginalProductKey
@phnahes
phnahes / td-agent.conf
Created April 8, 2020 13:26
Fluentd configuration for dnsquery logs
<source>
@type tail
path "/var/log/named/dnsquery.log"
pos_file "/var/log/td-agent/dnsquery.pos"
tag "es.dnsquery"
format /^(?<time>[^ ]* [^ ]*) [^.]* (?<ip>[^ ][^#]*).(?<port>[^ ][^ ]*). [^ ]* [^ ]* (?<fqdn>[^ ]*) (?<rectype>[^ ]* [^ ]* [^ ]*) (?<dnsserver>[^ ]*\d*)$/
time_format %d-%b-%Y %H:%M:%S.%L
</source>
<match es.**>
@phnahes
phnahes / m2070.md
Last active April 3, 2024 20:11
Printer Samsung M2070 working on Raspberry (armhf)

Install Cups

apt install cups samba cups-ipp-utils

Install Drivers

Download the Samsung ULD (Unified Linux Driver) version 1.00.29 from the SULDR website (the latest one on Samsung's website doesn't have an arm directory)

wget https://www.bchemnet.com/suldr/driver/UnifiedLinuxDriver-1.00.29.tar.gz