Skip to content

Instantly share code, notes, and snippets.

View skarllot's full-sized avatar
💭
I may be slow to respond.

Fabrício Godoy skarllot

💭
I may be slow to respond.
View GitHub Profile
@skarllot
skarllot / web-proxy.conf
Created October 30, 2013 19:50
Apache configuration to proxy requests to Glassfish server.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.example.com
ServerAlias example.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
@skarllot
skarllot / sshd
Created October 31, 2013 11:30
Two-factor authentication on SSH with Google authenticator
#%PAM-1.0
auth required pam_google_authenticator.so secret=${HOME}/.ssh/google_authenticator
auth required pam_sepermit.so
auth include password-auth
. . .
#/etc/pam.d/sshd
@skarllot
skarllot / NetworkConnection.cs
Last active December 27, 2015 08:29
File operations with network share.
// From Luke Quinane (http://stackoverflow.com/a/1197430/1028452)
//
// Usage:
// using (new NetworkConnection(@"\\server\read", readCredentials))
// using (new NetworkConnection(@"\\server2\write", writeCredentials)) {
// File.Copy(@"\\server\read\file", @"\\server2\write\file");
// }
public class NetworkConnection : IDisposable
{
@skarllot
skarllot / symlink_target.cs
Created November 7, 2013 17:47
Get symbolic link target
@skarllot
skarllot / bacula-dir.conf
Last active March 28, 2024 23:35
Bacula configuration to use sendEmail
. . .
Messages {
Name = Standard
mailcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] %t %e of %n %l\" \"%r\""
operatorcommand = "/usr/local/bin/sendEmail-backup \"[BACKUP] Intervention needed for %j\" \"%r\""
mail = [email protected] = all, !skipped
operator = [email protected] = mount
console = all, !skipped, !saved
append = "/var/log/bacula/bacula.log" = all, !skipped
catalog = all
@skarllot
skarllot / mysql_engine.sql
Created November 24, 2013 19:57
MySQL Tables Engine
SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE
FROM information_schema.TABLES
where ENGINE IS NOT NULL;
@skarllot
skarllot / iscsiadm.sh
Last active January 2, 2016 02:39
Managing iSCSI into Linux
# Create ifaces
iscsiadm -m iface -I iface0 -o new
iscsiadm -m iface -I iface0
iscsiadm -m iface -o update -I iface0 -n iface.net_ifacename -v eth0
# Discovery
iscsiadm -m discovery -t sendtargets -p 192.168.0.1 -I iface0 -I iface1
# Delete undesired targets
iscsiadm -m node -T iqn.2014-01.com.example:vol0 -p 192.168.0.1 -o delete
@skarllot
skarllot / create_user.sql
Last active December 22, 2016 09:35
Create MySQL user
-- CREATE USER AND GRANT PRIVILEGE
CREATE USER '[username]'@'localhost' IDENTIFIED BY '[password]';
GRANT [type of permission] ON [database name].[table name] TO '[username]'@'localhost' [WITH GRANT OPTION];
FLUSH PRIVILEGES;
-- PERMISSIONS LIST
-- ALL PRIVILEGES- allows a MySQL user all access to a designated database
-- CREATE- allows them to create new tables or databases
-- DROP- allows them to them to delete tables or databases
-- DELETE- allows them to delete rows from tables
@skarllot
skarllot / zabbix_agentd.conf
Created January 6, 2014 18:11
Zabbix 2.0 FreeBSD net.if.discovery
. . .
UserParameter=net.if.discovery,ifconfig | awk ' BEGIN { print "{\"data\":\[" } /^[a-z0-9]+\:/ { gsub(/\:/,"",$ 1); if ( $ 1 != "lo0" ) print "{ \"{#IFNAME}\":\"" $ 1"\" }," } END { print "{ \"{#IFNAME}\":\"lo0\"} \n]}" } '
@skarllot
skarllot / webacula
Last active January 2, 2016 12:18
Configure sudoers to Webacula
## /etc/sudoers.d/webacula
Defaults:apache !requiretty
apache ALL=(bacula) NOPASSWD: /usr/sbin/bconsole
## Bareos
# apache ALL=(bareos) NOPASSWD: /usr/sbin/bconsole
## Test using:
## `su -l apache -s /bin/sh \