Skip to content

Instantly share code, notes, and snippets.

@nileshgr
nileshgr / Email_Local.pm
Last active October 31, 2016 14:16
In-reply-to patch for Request Tracker ticket system
use strict;
use warnings;
no warnings qw(redefine);
package RT::Interface::Email;
sub ParseInReplyTo {
my $MessageId = shift;
$MessageId =~ s/<(.+)>/$1/;
chomp $MessageId;
#include <iostream>
#include <fcgio.h>
#include <asio.hpp>
#include <thread>
#include <unistd.h>
#include <string>
#define FCGI_SOCKET "/tmp/fcgi_socket"
void hello(asio::local::stream_protocol::socket& sock) {
@nileshgr
nileshgr / main.cf
Last active August 22, 2021 05:04
postfix
inet_interfaces = all
mynetworks_style = host
in_flow_delay = 10s
alias_maps = hash:/etc/aliases
recipient_delimiter = +
# ls -lh /usr/lib/libssl* :( 1 14-11-29 - 5:53:45
-r--r--r-- 1 root wheel 688K Nov 26 04:02 /usr/lib/libssl.a
lrwxr-xr-x 1 root wheel 11B Nov 26 04:02 /usr/lib/libssl.so -> libssl.so.7
-r--r--r-- 1 root wheel 429K Nov 26 04:02 /usr/lib/libssl.so.7
-r--r--r-- 1 root wheel 718K Nov 26 04:02 /usr/lib/libssl_p.a
root@mail1:~
# ls -lh /lib/libcrypt* 14-11-29 - 5:53:49
-r--r--r-- 1 root wheel 61K Nov 26 04:02 /lib/libcrypt.so.5
-r--r--r-- 1 root wheel 1.9M Nov 26 04:02 /lib/libcrypto.so.7
WRKDIRPREFIX= /var/ports
DISTDIR= /var/ports/distfiles
PACKAGES= /var/ports/packages
INDEXDIR= /var/ports
CPUTYPE=corei7-avx
CFLAGS+= -O2 -pipe
CXXFLAGS+= -O2 -pipe
COPTFLAGS= -O2 -pipe
PGSQL_DEFAULT?=9.3
# To specify the start up order of your ezjails, use these lines to
# create a Jail dependency tree. See rcorder(8) for more details.
#
# PROVIDE: standard_ezjail
# REQUIRE:
# BEFORE:
#
export jail_mail_hostname="mail"
export jail_mail_ip="lo2|10.0.0.2/24,re0|<ipv4>,re0|<ipv6>"
<Macro php $username $siteroot>
AddHandler php-fcgi .php
FastCgiExternalServer $siteroot/cgi-bin/php.fcgi -socket /var/run/php-fpm-$username.sock -pass-header Authorization -idle-timeout 600
Action php-fcgi /cgi-bin/php.fcgi
</Macro>
<Macro phpvhost $hostname $siteroot $username $aliases>
<VirtualHost *:80>
ServerName $hostname
ServerAlias www.$hostname $aliases
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} =/
RewriteCond %{HTTP_HOST} =www.site.com
RewriteRule (.*) http://www.site.com/folder/ [L]
@nileshgr
nileshgr / ipfw.rules
Last active June 11, 2021 11:58
IPFW rules for internal and external networking in FreeBSD jails
#!/bin/sh
alias ipfw=/sbin/ipfw
ipfw -f flush
# Make sure you have ipfw_nat_load=yes in loader.conf
# Map port 2201 on first public IP to first jail's port 22
ipfw nat 1 config ip <public ip> unreg_only same_ports redirect_port tcp 192.168.0.1:22 2201
@nileshgr
nileshgr / gist:5958106
Created July 9, 2013 15:04
Fallback for WebP serving using nginx So you want webp files to be named as .jpeg.webp in your htdocs. You link to images in your HTML as .jpeg. Nginx will detect if browser supports webp and automatically serve webp or jpeg (File extensions do NOT decide the type).
if ($http_accept ~* "webp") {
set $webp "true";
}
if (-e $request_filename.webp) {
set $webp "${webp}-local";
}
if ($webp = "true-local") {
rewrite (.*) $1.webp last;