Skip to content

Instantly share code, notes, and snippets.

View davidcastellani's full-sized avatar
🤘

David Castellani davidcastellani

🤘
View GitHub Profile

Keybase proof

I hereby claim:

  • I am davidcastellani on github.
  • I am davidcastellani (https://keybase.io/davidcastellani) on keybase.
  • I have a public key whose fingerprint is C541 19B9 8D12 0A13 A55B 8642 A0DE 462D 98C9 E614

To claim this, I am signing this object:

@davidcastellani
davidcastellani / expert_level_php.xml
Last active September 2, 2015 19:12 — forked from Swader/expert_level_php.xml
Expert level coding standards inspection for PHP in PHPStorm
<?xml version="1.0" encoding="UTF-8"?>
<inspections version="1.0" is_locked="false">
<option name="myName" value="Expert Level PHP" />
<option name="myLocal" value="false" />
<inspection_tool class="BadExpressionStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CallerJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="CommaExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantConditionalExpressionJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantIfStatementJS" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ContinueOrBreakFromFinallyBlockJS" enabled="false" level="WARNING" enabled_by_default="false" />
@davidcastellani
davidcastellani / latency.txt
Created May 17, 2016 13:25 — forked from lyoshenka/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@davidcastellani
davidcastellani / passwordgen.sh
Created May 17, 2016 13:26 — forked from lyoshenka/passwordgen.sh
Bash Random Password Generator
#!/bin/bash
head -n100 /dev/urandom | strings | egrep -o '([a-zA-Z0-9#%&^])' | awk '{ORS=""; print $1}' | head -c 35; echo
@davidcastellani
davidcastellani / mysql_check_slave.sh
Created May 17, 2016 13:26 — forked from lyoshenka/mysql_check_slave.sh
Check that MySQL slave is running and no errors are present. Optionally send an email if errors are detected.
#!/bin/bash
set -euo pipefail
### CONFIG
EMAIL_ADDR="" # email this address if errors detected
MAX_SECONDS_BEHIND=5 # max seconds that slave can be behind master
@davidcastellani
davidcastellani / migrate
Created January 29, 2018 21:23
Move Proxmox Container to Different Storage (Updated for LXC)
#!/bin/bash
#
# Filename : migrate
# Description : Migrate Proxmox OpenVZ container from one storage to another
# Author : James Coyle
# URL: https://www.jamescoyle.net/how-to/2863-move-proxmox-container-to-different-storage-2
# Version:
# -Date -Author -Description
# 20-11-2013 James Coyle Initial
# 13-12-2017 James Coyle Changes for LXC
#!/bin/sh
#Bail if borg is already running, maybe previous run didn't finish
if pidof -x borg >/dev/null; then
echo "Backup already running"
exit
fi
# Setting this, so the repo does not need to be given on the commandline:
export BORG_REPO=/mnt/backup/prox01/main