Skip to content

Instantly share code, notes, and snippets.

View karthiks's full-sized avatar
🎯
Focusing

Karthik Sirasanagandla karthiks

🎯
Focusing
View GitHub Profile
@karthiks
karthiks / enabled_apache_extensions.sh
Created September 13, 2021 12:46
verify whether the mod_evasive module is enabled
apachectl -M | grep evasive
# Output:
# [Mon Jan 27 13:55:35.707317 2020] [so:warn] [pid 29031] AH01574: module dav_module is already loaded, skipping
# evasive20_module (shared)
@karthiks
karthiks / apache2.conf
Created September 13, 2021 12:19
/etc/apache2/apache2.conf file
SetEnvIf Remote_Addr "::1" loopback
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog /var/log/apache2/access.log combined env=!loopback
@karthiks
karthiks / conf
Created July 21, 2021 18:30
Ops Agent configuration to send the Apache2 webserver logs as well apart from the syslogs to Google Cloud Monitoring
logging:
receivers:
mywebserver:
type: files
include_paths:
- /var/log/apache*/access.log
- /var/log/apache*/error.log
- /var/www/logs/any-other-custom-logs-of-your-app-*.log
service:
pipelines:
@karthiks
karthiks / conf
Created July 21, 2021 18:02
Apache configuration file for the default website
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteMap hosts-deny "txt:/etc/apache2/blacklist"
RewriteCond "${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}" "!=NOT-FOUND" [OR]
RewriteCond "${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}" "!=NOT-FOUND"
RewriteRule .* - [F]
@karthiks
karthiks / conf
Created July 21, 2021 17:58
Select part of Apache configuration file for the default website
RewriteEngine on
RewriteMap hosts-deny "txt:/etc/apache2/blacklist"
RewriteCond "${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}" "!=NOT-FOUND" [OR]
RewriteCond "${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}" "!=NOT-FOUND"
RewriteRule .* - [F]
@karthiks
karthiks / conf
Created July 21, 2021 17:53
Range of IP Addresses
71.119.54.101 -
52.123.54.102 -
@karthiks
karthiks / .sh
Created July 21, 2021 17:47
change ownership of file in ubuntu
chown www-data.www-data /etc/apache2/blacklist
@karthiks
karthiks / nginx
Created December 20, 2020 11:51
default logrotation for nginx located at /etc/logrotate.d/nginx (per app logrotate is configured this way)
/var/log/nginx/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 0640 www-data adm
sharedscripts
prerotate

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

# Know the id of the username in the original distro that was exported
wsl -d Ubuntu-20.04 -u kartz -e id -u
# Outputs 1000
# Knowing the id of the username in the distro that was created by importing the tar image
wsl -d Ubuntu-20 -u kartz -e id -u
# Outputs 1000
# I would want to use this distroname and id, to set this user as the default login profile of WSL.
# I set this up in Windows Registry with the line snippet below: