Skip to content

Instantly share code, notes, and snippets.

View korovamilk's full-sized avatar
🏠
Working from home

Marco Agate korovamilk

🏠
Working from home
View GitHub Profile
@korovamilk
korovamilk / cf-ddns.sh
Created January 13, 2017 14:32 — forked from larrybolt/cf-ddns.sh
Automatically update your CloudFlare DNS record to the IP, Dynamic DNS for Cloudflare
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# /usr/local/bin/cf-ddns.sh
@korovamilk
korovamilk / README.md
Created December 7, 2015 07:36 — forked from e7d/README.md
[Debian] Build a Squid transparent proxy from source code
@korovamilk
korovamilk / .bash_profile
Created April 2, 2015 06:50
Cygwin customization. Add to .bash_profile
#### Set english as default language
LANG='en_GB.UTF-8'
#### Start ssh-agent on first terminal session
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
@korovamilk
korovamilk / alert_user_login.sh
Last active August 29, 2015 14:17
Add this to .bashrc of user. When user logs in (via ssh or console), you receive an e-mail at ${DEST_EMAIL}
### add this to .bashrc
DEST_EMAIL="MY_SPAM_JAM@gmail.com"
TMPCOOKIE="/tmp/cookie.$(date +%y%m%d%H%M%S)"
CONNIP=$(echo $SSH_CONNECTION | cut -d " " -f 1)
touch ${TMPCOOKIE}
if [ -z "$CONNIP" ]
then
echo "${HOSTNAME}: User $USER just logged in from console" >> ${TMPCOOKIE}
echo >> ${TMPCOOKIE}
w >> ${TMPCOOKIE}
@korovamilk
korovamilk / CYG64_launch_faucets.sh
Created February 19, 2015 07:30
CYGWIN shell script to automatically launch on Firefox a pretty good collection of Bitcoin, Litecoin and Worldcoin faucets.
#!/bin/bash
# author: marco @ agate . io
# if this helped, donate your LTC here: Lcu3TvhGEfKfPndRMhoWjkSk9dAFXhYrn2
FIREFOXBIN="/cygdrive/c/Program\ Files\ \(x86\)/Mozilla\ Firefox/firefox.exe -new-tab"
launchURL() {
myURL="$1"
faucet_name=$(echo $1 | cut -d\/ -f3)
echo "$(date +%H:%M:%S) ~ ${faucet_name}"
/cygdrive/c/Program\ Files\ \(x86\)/Mozilla\ Firefox/firefox.exe -new-tab "${myURL}" &
@korovamilk
korovamilk / keybase.md
Created January 13, 2015 15:58
keybase.io verification

Keybase proof

I hereby claim:

  • I am korovamilk on github.
  • I am korovamilk (https://keybase.io/korovamilk) on keybase.
  • I have a public key whose fingerprint is F8E8 D517 E9D0 9E8D 880B 0064 5ED1 D31E 5146 7A9D

To claim this, I am signing this object:

@korovamilk
korovamilk / l2chroot.sh
Created November 12, 2014 13:48
copy sharedlibs to chroot jail
#!/bin/bash
# Use this script to copy shared (libs) files to Apache/Lighttpd chrooted
# jail server.
# ----------------------------------------------------------------------------
# Written by nixCraft <http://www.cyberciti.biz/tips/>
# (c) 2006 nixCraft under GNU GPL v2.0+
# + Added ld-linux support
# + Added error checking support
# ------------------------------------------------------------------------------
# See url for usage:
@korovamilk
korovamilk / shell_confirm_snippet.sh
Last active August 29, 2015 14:08
Shell confirm snippet
#!/bin/bash
confirm() {
echo -n "Continue? (y/n) "
read answer
case $answer in
y|Y|j|J"") return 0 ;;
n|N) return 1 ;;
*) confirm ;;
esac
@korovamilk
korovamilk / awk_pattern_count_print.sh
Created September 12, 2014 09:42
Find Pattern in file and print matching strings when occurencies > 1 (per line)
# example email - real name list "<filename>"
# (note that name4 entry is broken - email appears 2 times
name1@example.com;"Real Name"
name2@example.com;"Real Name"
name3@example.com;"Real Name"
name4@example.com;name4@example.com;"Real Name"
# following awk will find and print the lines with MORE than one matching pattern
# (here I grep for "@")
$ awk '{n=split($0,c,"@")-1;if (n>1) print $0 }' <filename>
@korovamilk
korovamilk / update_hosts.sh
Last active February 15, 2024 14:44
Update Ad-Free /etc/hosts file from public lists
#!/bin/bash
TMP_FILE="/tmp/hosts"
HOSTS_FILE="/etc/hosts"
# WINDOWS: %systemroot%\system32\drivers\etc\hosts
touch ${TMP_FILE}
for URL in http://adaway.org/hosts.txt \
http://winhelp2002.mvps.org/hosts.txt \
http://someonewhocares.org/hosts/hosts \