Skip to content

Instantly share code, notes, and snippets.

View ao's full-sized avatar
😶‍🌫️

Andrew O ao

😶‍🌫️
View GitHub Profile
@ao
ao / gist:b41d430861cf427cc749
Created January 19, 2015 12:55
ubuntu - check syntax of mysql my.cnf
/usr/sbin/mysqld <options> --help --verbose
@ao
ao / gist:5c74cab3c7e40fad69ae
Created October 16, 2015 11:01
most common commandline commands
history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r
@ao
ao / gist:0dbc442579a8de514ddf
Created January 15, 2016 14:28
Commandline Speedtest - Bash/SH
#!/bin/bash
cname=$( awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo )
cores=$( awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo )
freq=$( awk -F: ' /cpu MHz/ {freq=$2} END {print freq}' /proc/cpuinfo )
tram=$( free -m | awk 'NR==2 {print $2}' )
swap=$( free -m | awk 'NR==4 {print $2}' )
up=$(uptime|awk '{ $1=$2=$(NF-6)=$(NF-5)=$(NF-4)=$(NF-3)=$(NF-2)=$(NF-1)=$NF=""; print }')
echo "CPU model : $cname"
@ao
ao / gist:86f7f667bc968fbd59b9
Created February 5, 2016 14:36
Access.log. sort by occurrence
cat access.log | awk -F\" '{print $6}' | sort | uniq -c | sort -n
@ao
ao / gist:5d064a0f58e0c1eb8baae4385d62d54c
Created September 21, 2016 09:50
macosx commandline fun
fortune -s computers | cowsay -f dragon | lolcat
@ao
ao / gist:9ccacaf93b16482120790d05be3f626c
Created September 21, 2016 09:57
Python Zen - CLI output
python -c "import sys, random; stdout = sys.stdout; sys.stdout = type('BlackHole', (), {'write': (lambda self, string: '')})(); import this; sys.stdout = stdout; print random.choice(''.join([this.d.get(i, i) for i in this.s]).splitlines()[2:]);"
@ao
ao / gist:79eb1cffd1b9cc52d0c8933fb75180c6
Created September 22, 2016 15:47
useful magento2 cli commands
----
rm -rf var/di var/generation
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:di:compile
chmod -R 777 var
----
@ao
ao / getServer.py
Last active October 26, 2016 10:11
Python: Identify/Get the hosting Server from a list of domain names (commandline)
import sys
import requests
import random
from multiprocessing.dummy import Pool as ThreadPool
'''
Usage:
$ python server.py random 25
$ python server.py google.com
@ao
ao / javascript.js
Created October 29, 2016 18:03
Codility: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
function solution(N) {
var binary = N.toString(2);
var length = binary.length;
var ones = [];
for(var i=0; i<length; i++) {
if (binary[i]=='1') ones.push(i);
}
@ao
ao / Working Digital Ocean Promotional Codes for January, February, March, April and May 2018.md
Last active February 2, 2018 00:02
Working Digital Ocean Promotional Codes for January, February, March, April and May 2018

Working Digital Ocean Promotional Codes for January, February, March, April and May 2018

Want a Discount?

  1. Sign up with this link to save your first $10!
  2. Use one of the Promocodes below to save an additional $10-$15
  • LOWENDBOX (<- worth the most ($15)!)
  • DODEPLOY (<- $10)