Skip to content

Instantly share code, notes, and snippets.

View rafaelfoster's full-sized avatar

Rafael Foster rafaelfoster

View GitHub Profile
@rafaelfoster
rafaelfoster / gencert.py
Created June 29, 2017 21:41 — forked from flabbergastedbd/gencert.py
A python script which generates certificates and signs them using a specified CA.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# gencert.py
#
# Copyright 2013 tunnelshade <blog.tunnelshade.in>
#
# * openssl genrsa -des3 -out ca.key 1024
#
# * openssl req -new -x509 -days 3650 -key ca.key -out ca.crt
' JoinDomain.vbs
' VBScript program to join a computer to a domain.
' The computer account is created in Active Directory.
' The computer must have XP or above.
' The AD must be W2k3 or above.
' See c:\Windows\debug\NetSetup.log for details.
Option Explicit
Dim strDomain, strUser, strPassword, strOU
@rafaelfoster
rafaelfoster / RenameComputer.vbs
Created April 25, 2017 14:08
'Rename computer by seria
'Rename computer by serial # v1.0 November 2009
dim Bios, BiosSerial, objFSO, objTextFile
'Const ForReading = 1, ForWriting = 2, ForAppending = 8
'get serial number
for each Bios in GetObject("winmgmts:").InstancesOf ("win32_bios")
BiosSerial = Bios.SerialNumber
exit for
next
@rafaelfoster
rafaelfoster / my.cnf
Last active March 6, 2017 04:13
Mysql configuration
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
#SSHFS on /etc/fstab
root@server:/dir /mount fuse.sshfs IdentityFile=/home/rafael/.ssh/id_rsa,allow_other,reconnect 0 0
@rafaelfoster
rafaelfoster / myip.fish
Created February 22, 2017 14:39
Fish function to retrieve public IP address saved on ~/.config/fish/functions/myip.fish
function myip
curl -s www.meuip.com.br | grep -oE "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" | uniq
end
@rafaelfoster
rafaelfoster / nginx_compile_pagespeed_passenger
Last active October 12, 2016 01:54
Compile Nginx with Passenger and Pagespeed
./configure \
--add-module=/usr/local/share/gems/gems/passenger-5.0.18/ext/nginx \
--add-module=/etc/nginx/modules/ngx_pagespeed-release-1.11.33.2-beta \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
@rafaelfoster
rafaelfoster / samba_compile_promote
Created October 12, 2016 01:47
Compiling and promoting Samba4
yum install perl gcc attr libacl-devel libblkid-devel \
gnutls-devel readline-devel python-devel gdb pkgconfig \
krb5-workstation zlib-devel setroubleshoot-server libaio-devel \
setroubleshoot-plugins policycoreutils-python \
libsemanage-python perl-ExtUtils-MakeMaker perl-Parse-Yapp \
perl-Test-Base popt-devel libxml2-devel libattr-devel \
keyutils-libs-devel cups-devel bind-utils libxslt \
docbook-style-xsl openldap-devel autoconf python-crypto pam-devel
./configure \
@rafaelfoster
rafaelfoster / yahoo_exchange_rates_jsonp.html
Created September 8, 2016 17:17 — forked from henrik/yahoo_exchange_rates_jsonp.html
JavaScript to get currency exchange rates from Yahoo Finance as JSONP. No XHR!
Get exchange rate as JSONP via YQL.
YQL Console: http://developer.yahoo.com/yql/console
Query (USD to SEK): select rate,name from csv where url='http://download.finance.yahoo.com/d/quotes?s=USDSEK%3DX&f=l1n' and columns='rate,name'
Example code:
<script type="text/javascript">
# Enable zimbra log to syslog (zimbra.log)
zmprov mcf zimbraLogToSysLog TRUE