Skip to content

Instantly share code, notes, and snippets.

View kozhin's full-sized avatar

Konstantin Kozhin kozhin

View GitHub Profile
@kozhin
kozhin / run.bash
Created July 4, 2021 14:44
Fetch IP addresses for Akamai host
#!/bin/bash
temp="/tmp/temp.log"
output="/tmp/uniq.log"
dig lolstatic-a.akamaihd.net +short | \
awk '/((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}/ { print $1 }' >> $temp
while IFS= read -r line
do
@kozhin
kozhin / nginx.conf
Created July 4, 2019 13:57 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@kozhin
kozhin / swap.service
Last active October 2, 2017 11:42
CoreOS swap configuration for systemd
# /etc/systemd/system/swap.service
[Unit]
Description=Turn on swap
[Service]
Type=oneshot
Environment="SWAP_PATH=/var/vm" "SWAP_FILE=swapfile1"
ExecStartPre=-/usr/bin/rm -rf ${SWAP_PATH}
ExecStartPre=/usr/bin/mkdir -p ${SWAP_PATH}
@kozhin
kozhin / profile
Created April 4, 2016 20:10
Bash colors
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
@kozhin
kozhin / run.sh
Last active October 2, 2017 11:47
Batch rename shell script for files with specific extension
#!/bin/bash
a=1
e='JPG'
for i in *.$e; do
new=$(printf "%04d.$e" "$a") #04 pad to length of 4
mv -- "$i" "$new"
let a=a+1
done
@kozhin
kozhin / background.css
Last active October 2, 2017 11:44
Background image for retina screens
background-color: transparent;
background-size: 100px 100px;
background-repeat: no-repeat;
background-position: top center;
background-image: url("bg.png");
@media
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and ( min--moz-device-pixel-ratio: 2),
only screen and ( -o-min-device-pixel-ratio: 2/1),
@kozhin
kozhin / antiglow.css
Created June 22, 2015 22:25
Anti-glow for form input elements
select, textarea, button, a, input[type=submit] {
outline: none !important;
}
@kozhin
kozhin / elements.css
Created June 22, 2015 22:24
Input elements types
textarea,
input[type="text"],
input[type="password"],
input[type="datetime"],
input[type="datetime-local"],
input[type="date"],
input[type="month"],
input[type="time"],
input[type="week"],
input[type="number"],