Skip to content

Instantly share code, notes, and snippets.

View damiann's full-sized avatar
🏴
Ę̮̱͔͓ͯ͗ͫ̌̏ͫ͌́x̘̤͚̰̫̫̗̤̱̒̓ͨͯ͑̓ͥͫ̕å̰͚̓͒ͫm̛̤͕̫̳̺̩̄̓ͨͥ͜ͅp̰͉͗ͤl̵̖̗̫͍͓͋̍̐͌̐̒e̡̧̿͒͋̈́͡

Damian damiann

🏴
Ę̮̱͔͓ͯ͗ͫ̌̏ͫ͌́x̘̤͚̰̫̫̗̤̱̒̓ͨͯ͑̓ͥͫ̕å̰͚̓͒ͫm̛̤͕̫̳̺̩̄̓ͨͥ͜ͅp̰͉͗ͤl̵̖̗̫͍͓͋̍̐͌̐̒e̡̧̿͒͋̈́͡
View GitHub Profile
@damiann
damiann / gist:8429299
Created January 15, 2014 01:42
Live Free or Die
░░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄░░░░░░░░░
░░░░░░░░▄▀░░░░░░░░░░░░▄░░░░░░░▀▄░░░░░░░
░░░░░░░░█░░▄░░░░▄░░░░░░░░░░░░░░█░░░░░░░
░░░░░░░░█░░░░░░░░░░░░▄█▄▄░░▄░░░█░▄▄▄░░░
░▄▄▄▄▄░░█░░░░░░▀░░░░▀█░░▀▄░░░░░█▀▀░██░░
░██▄▀██▄█░░░▄░░░░░░░██░░░░▀▀▀▀▀░░░░██░░
░░▀██▄▀██░░░░░░░░▀░██▀░░░░░░░░░░░░░▀██░
░░░░▀████░▀░░░░▄░░░██░░░▄█░░░░▄░▄█░░██░
░░░░░░░▀█░░░░▄░░░░░██░░░░▄░░░▄░░▄░░░██░
░░░░░░░▄█▄░░░░░░░░░░░▀▄░░▀▀▀▀▀▀▀▀░░▄▀░░
@damiann
damiann / coor
Last active January 3, 2016 07:09
#!/usr/local/bin/python2.7
import urllib2, json
def get_coorinates(request):
eat_all = Eat.objects.all().values()
for eat in eat_all:
obj = Eat.objects.filter(id=eat['id'])[0]
address = obj.address.replace(" ", "+")
url = "".join(["http://maps.googleapis.com/maps/api/geocode/json?address=", address, "&sensor=false"]);
@damiann
damiann / gist:6892732
Last active December 25, 2015 01:09
MODx Print Event Request
<?php
/**
* checking the $resource object when event runs
*/
switch ($modx->event->name) {
case 'OnBeforeDocFormSave':
$modx->log(modX::LOG_LEVEL_INFO, print_r($resource));
break;
case 'OnDocFormSave':
@damiann
damiann / send_email
Last active October 12, 2020 16:48
Send Magento template email with attachment.
<?
// using model magento\app\code\core\Mage\Core\Model\Email\Template.php
public function send_error_email($error = NULL) {
$mailTemplate = Mage::getModel('core/email_template');
$mailTemplate->setSenderName('Insert Sender Name'); // use general Mage::getStoreConfig('trans_email/ident_general/name');
$mailTemplate->setSenderEmail('insert@sender.email'); // use general Mage::getStoreConfig('trans_email/ident_general/email')
$mailTemplate->setTemplateSubject('Insert Subject Title');
$mailTemplate->setTemplateText('Insert Body Text');
<?
$write = Mage::getSingleton("core/resource")->getConnection("core_write");
$query = "insert into mage_example (name, email, company, description, status, date) values (:name, :email, :company, :desc, 0, NOW())";
$binds = array(
'name' => "name' or 1=1",
'email' => "email",
'company' => "company",
'desc' => "desc",
);
@damiann
damiann / gist:6234664
Created August 14, 2013 19:30
First 5 minutes on server
Let’s Get Started
Our box is freshly hatched, virgin pixels at the prompt. I favor Ubuntu; if you use another version of linux, your commands may vary. Five minutes to go:
passwd
Change the root password to something long and complex. You won’t need to remember it, just store it somewhere secure - this password will only be needed if you lose the ability to log in over ssh or lose your sudo password.
apt-get update
apt-get upgrade
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\[\e[32;0m\]\h:\u@\W \$(parse_git_branch)$ \[\e[0m\]"
@damiann
damiann / gist:5808016
Created June 18, 2013 18:33
tasks for setting up new server
Prevent framing:
Debian/Ubuntu servers /etc/apache2/apache2.conf
Header always append X-Frame-Options SAMEORIGIN
or
nginx:
add_header X-Frame-Options SAMEORIGIN;
HTTP TRACE:
TraceEnable Off
@damiann
damiann / gist:5229033
Last active December 15, 2015 08:09
EC2 SSH
ssh -i keypair.pem ec2-user@0.0.0.0
MC -
screen -S minecraft java -Xincgc -Xmx1G -jar minecraft_server.jar
@damiann
damiann / psy.html
Created February 12, 2013 19:49
PSY - YouTube
<style>
.watch-dancing-psy {
background: url(http://s.ytimg.com/yts/img/logo_dancing_psy-vflsJl9hC.gif) no-repeat -73px 1px;
width: 20px;
height: 30px;
margin-top: 0px;
}
</style>
<img class="watch-dancing-psy" src="//s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif">