Skip to content

Instantly share code, notes, and snippets.

View xikaos's full-sized avatar

Francisco Budaszewski Zanatta xikaos

  • Tiny ERP by Olist
  • Brazil
  • 12:52 (UTC -03:00)
View GitHub Profile
RewriteCond %{HTTP_HOST} ^example\.com$ [NC] # Here goes the regex to match the domain that will be redirected
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net$ [NC] # Create a new condition for every domain, if possible
RewriteRule ^(.*)$ http://www.example.it/$1 [R=301,NC,L]
# Force redirect to www
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,NC,L]
</IfModule>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" style="padding: 20px 0 0 0;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#f46e6c" style="padding: 12px 18px 12px 18px; -webkit-border-radius:3px; border-radius:3px" align="center"><a href="http://litmus.com" style="font-size: 16px; font-family: Arial, sans-serif; font-weight: normal; color: #ffffff; text-decoration: none;">Learn more &rarr;</a></td>
</tr>
</table>
</td>
</tr>
@xikaos
xikaos / .htaccess
Last active April 13, 2016 18:31 — forked from Jesm/.htaccess
Just some trivial tasks to do with .htaccess
<IfModule mod_rewrite.c>
# Redirect to another domain
RewriteCond %{HTTP_HOST} ^example\.com$ [NC] # Here goes the regex to match the domain that will be redirected
RewriteCond %{HTTP_HOST} ^(www\.)?example\.net$ [NC] # Create a new condition for every domain, if possible
RewriteRule ^(.*)$ http://www.example.it/$1 [R=301,NC,L]
# Force redirect to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
<% favicons.each do |favicon| %>
<% unless favicon[:rel].nil? %>
<link rel="<%= favicon[:rel]%>" sizes="<%= favicon[:size]%>" href="<%= data.informacoes_do_site.hostname + "/" + favicon[:icon]%>">
<% end -%>
<% end -%>
@mixin test-img-alt {
img {
border: 2px dotted red;
}
img[alt] {
border: none;
}
}
@mixin test-link-title {
defmodule Palindromes do
def run do
["amor", "roma", "phoenix", "mora", "elixir"]
|> Enum.group_by(&canonicalize/1)
|> IO.inspect
end
defp canonicalize(word) do
word
|> String.graphemes
@xikaos
xikaos / .iex.exs
Last active August 30, 2016 12:46
defmodule R do
def reload! do
Mix.Task.reenable "compile.elixir"
Application.stop(Mix.Project.config[:app])
Mix.Task.run "compile.elixir"
Application.start(Mix.Project.config[:app], :permanent)
end
end
du -sh dir/ | sort -hr | head -n10
@xikaos
xikaos / varpost.php
Created January 12, 2018 12:46
Varpost
function varpost($endpoint, $data){
$ch = curl_init($endpoint);
curl_setopt_array($ch, array(
CURLOPT_POST => TRUE,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
CURLOPT_POSTFIELDS => json_encode($data)
));
@xikaos
xikaos / tcpdump http monitoring
Last active January 12, 2018 21:31 — forked from bahayman/gist:9369651
tcpdump http monitor
~// WARNING: The command DOES NOT WORK if you don't have root access to yout network device. Prepend sudo if you are not root. \\~
Use TCPDUMP to Monitor HTTP Traffic
1. To monitor HTTP traffic including request and response headers and message body:
tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
2. To monitor HTTP traffic including request and response headers and message body from a particular source:
tcpdump -A -s 0 'src example.com and tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'