Skip to content

Instantly share code, notes, and snippets.

@webchi
webchi / iptables.sh
Created February 24, 2021 13:18 — forked from Tristor/iptables.sh
Simple IPtables script for an OpenVPN server
#!/bin/bash
# Flushing all rules
iptables -F FORWARD
iptables -F INPUT
iptables -F OUTPUT
iptables -X
# Setting default filter policy
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
@webchi
webchi / consul.xml
Created October 30, 2018 09:13 — forked from fabricekabongo/consul.xml
Service definition of Consul for Firewalld
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>consul</short>
<description>Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. Register external services such as SaaS providers as well.</description>
<port protocol="tcp" port="8300"/>
<port protocol="tcp" port="8301"/>
<port protocol="tcp" port="8302"/>
<port protocol="tcp" port="8400"/>
<port protocol="tcp" port="8500"/>
<port protocol="tcp" port="8600"/>
@webchi
webchi / gist:0daa94cdb7b098171170c4dd9058fc52
Created April 5, 2018 07:05 — forked from mislav/gist:938183
Faraday SSL example
connection = Faraday::Connection.new('http://example.com') do |builder|
builder.request :url_encoded # for POST/PUT params
builder.adapter :net_http
end
# same as above, short form:
connection = Faraday.new 'http://example.com'
# GET
connection.get '/posts'
@webchi
webchi / devise_helper.rb
Last active February 26, 2016 20:17 — forked from seyhunak/devise_helper.rb
Devise Error Messages Twitter Bootstrap style
# /app/helpers/devise_helper.rb
module DeviseHelper
def devise_error_messages!
return '' if resource.errors.empty?
messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join
sentence = I18n.t('errors.messages.not_saved',
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)