Skip to content

Instantly share code, notes, and snippets.

@dashr
dashr / quickie deny
Created February 20, 2014 07:05
send a simple 404 to users looking for a certain folder
<IfModule mod_rewrite.c>
ErrorDocument 404 "<H1>Page not found</H1>"
RewriteEngine On
RewriteBase /
RewriteRule ^(bigNoNo/*) - [R=404,L]
</IfModule>
# from: https://www.petekeen.net/know-how-to-roll-your-ssl-certificates
# look into: https://github.com/tilsammans/playbook/tree/master/roles/rails/templates
desc "Generate a new key"
task :gen_key do
domain = get_env(:domain)
filename = "#{domain}.key"
`openssl genrsa -out #{filename} 2048`
end
@dashr
dashr / shellshock-fix
Last active August 29, 2015 14:06
shellshock
#test on command line
$ env VAR='() { :;}; echo Bash is vulnerable!' bash -c "echo Bash Test"
#Fix on ubuntu (debian based)
$ sudo apt-get update && sudo apt-get install --only-upgrade bash
#Fix on CentOS/ Cpanel
$ sudo yum update bash
[
{
"id": 609620,
"name": "Compton Unified",
"address": "501 S.santa Fe Ave",
"city": "Compton",
"state": "CA",
"zip": "90221",
"country": "US",
"lat": 33.892303,
[
{
"id": 628050,
"name": "Oakland Unified",
"address": "1025 Second Ave",
"city": "Oakland",
"state": "CA",
"zip": "94606",
"country": "US",
"lat": 37.796749,
@dashr
dashr / aschool.json
Last active August 29, 2015 14:08
Requesting a school record ( http://oldschooldb.com/v1/schools/62949011462 )
[
{
"id": 62949011462,
"district_id": 629490,
"name": "Pajaro Valley High",
"address": "500 Harkins Slough Rd",
"city": "Watsonville",
"state": "CA",
"zip": "95076",
"country": "US",
[
{
"id": 62949004547,
"district_id": 629490,
"name": "Pajaro Middle",
"address": "250 Salinas Rd",
"city": "Watsonville",
"state": "CA",
"zip": "95076",
"country": "US",
@dashr
dashr / gist:f39704b9f8b7ba46023a
Created February 25, 2015 00:46
A+ SSL config nginx
ssl_certificate /etc/nginx/ssl/star.domain.pem;
ssl_certificate_key /etc/nginx/ssl/star.domain.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
# Add HSTS
@dashr
dashr / drupal6_memcached_single.php
Created March 7, 2011 22:13
only use memcached plugin if memcached responds
/**
* Use Memcached (if its on):
*
* Enable these configurations if a Memcached server is running on the
* server. This will move the database load from MySQL to Memcached,
* increasing the site speed and lowering the database lag.
*
* cache_inc = replaces the Drupal caching mechanism
* session_inc = replaces the Drupal mysqldb Sessions handler
* memcache_key_prefix should be set to a short unique string in multi Drupal environment
@dashr
dashr / d6_form_snippets.php
Created April 6, 2011 20:17
seldom used form snippets
$hooks['user_profile_form'] = array(
'arguments' => array('form' => NULL)
);
function theme_user_profile_form($form) {}
if ($vars['menu_item']['map'][0]=='user') {
if ($vars['menu_item']['map'][2]=='edit') {
drupal_goto('trainings') ; #var_dump($_GET);
}