Skip to content

Instantly share code, notes, and snippets.

View thebouv's full-sized avatar
🐍
Automating and/or breaking things

Anthony Bouvier thebouv

🐍
Automating and/or breaking things
View GitHub Profile
@thebouv
thebouv / ducks.sh
Last active April 1, 2024 18:11
ducks: linux command for the 10 largest files in current directory
du -cks * | sort -rn | head -11
# Usually set this up in my bash profile as an alias:
# alias ducks='du -cks * | sort -rn | head -11'
# Because it is fun to type ducks on the command line. :)
@thebouv
thebouv / conncount.sh
Last active January 4, 2016 20:09
conncount: linux command listing current IPs connected and how many connections
# Very handy one-liner from DDoS Deflate project. Useful just by itself.
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
# As an alias:
# alias conncount='netstat -ntu | awk '\''{print $5}'\'' | cut -d: -f1 | sort | uniq -c | sort -nr'
@thebouv
thebouv / gist:8742647
Created January 31, 2014 20:37
Return list of column names as a commas separated list
SELECT GROUP_CONCAT( COLUMN_NAME )
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'my_table';
@thebouv
thebouv / proxy.php
Created February 18, 2014 18:38
PHP POST proxy
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $REMOTEURLHERE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
$data = curl_exec($ch);
curl_close($ch);
@thebouv
thebouv / getRandom.php
Created February 19, 2014 16:19
PHP random string generation (for file names, etc)
function getRandom($length = 10) {
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}
@thebouv
thebouv / .bashrc
Created May 30, 2014 20:20
Colorful .bashrc for my OS X machines
export PS1="\[\e[00;36m\]\u\[\e[0m\]\[\e[00;37m\]@\h:\[\e[0m\]\[\e[00;33m\][\W]\[\e[0m\]\[\e[00;36m\]:\[\e[0m\]\[\e[00;37m\] \[\e[0m\]"
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
@thebouv
thebouv / nogutter.css
Created June 25, 2014 13:25
.no-gutter class for Bootstrap 3
.row.no-gutter {
margin-left: 0;
margin-right: 0;
}
.row.no-gutter [class*='col-']:not(:first-child),
.row.no-gutter [class*='col-']:not(:last-child) {
padding-right: 0;
padding-left: 0;
}
@thebouv
thebouv / attribute.txt
Created June 25, 2014 17:53
CSS attribute selector syntax
[att] Represents an element with the att attribute, whatever the value of the attribute.
[att=val] Represents an element with the att attribute whose value is exactly "val".
[att~=val] Represents an element with the att attribute whose value is a whitespace-separated list of words, one of which is exactly "val". If "val" contains whitespace, it will never represent anything (since the words are separated by spaces). Also if "val" is the empty string, it will never represent anything.
[att^=val] Represents an element with the att attribute whose value begins with the prefix "val". If "val" is the empty string then the selector does not represent anything.
[att$=val] Represents an element with the att attribute whose value ends with the suffix "val". If "val" is the empty string then the selector does not represent anything.
@thebouv
thebouv / web.config
Created July 1, 2014 20:13
IP restrict on Azure
<security>
<ipSecurity allowUnlisted="false" denyAction="NotFound">
<add allowed="true" ipAddress="1.2.3.4"/>
</ipSecurity>
</security>
or
http://azure.microsoft.com/blog/2013/12/09/ip-and-domain-restrictions-for-windows-azure-web-sites/
@thebouv
thebouv / preventDefault.js
Created July 29, 2014 20:17
preventDefault fix
(e.preventDefault) ? e.preventDefault() : event.returnValue = false;