Rolly Maulana Awangga :: Catatan Ngoprek IT

Pakar dan Awam sama saja, sama sama belajar

Python Outlook(Microsoft email service) IMAP4 Library

Python Library to read email from live, hotmail, outlook or any microsoft email service, just dowload to yout python script folder. This library using Imaplib python to read email with IMAP protocol.

go here : https://github.com/awangga/outlook

Example

To get latest Unread Message in inbox :

import outlook
mail = outlook.Outlook()
mail.login('emailaccount@live.com','yourpassword')
mail.inbox()
print mail.unread()

To get latest Unread Message in Junk :

import outlook
mail = outlook.Outlook()
mail.login('emailaccount@live.com','yourpassword')
mail.junk()
print mail.unread()

Retrive email element :

print mail.mailbody()
print mail.mailsubject()
print mail.mailfrom()
print mail.mailto()

Tips Git Untuk Pemula

Ada beberapa tips disini:

1. SERING COMMIT, ada perubahan dan selesai dikerjakan maka COMMIT. ada typo? benerin lalu commit, jangan digabung sama yang lain
2. 1 COMMIT 1 issue, bukan sekian issue 1 commit, commit
3. Sebelum PUSH wajib PULL,git push ? git pull dulu, pastikan ngga ada conflict
4. Kalo ada conflict harus dibenerin dulu, jangan push kalo ngga paham
5. Sering2 git status dan git diff, lihat mana yang belum di commit dan adakah yang belum di push
6. Sering2 PUSH (ingat yang ke 3), jangan biarkan akhir hari masih ada yang belum di PUSH
7. Jangan git add . tapi git add
8. Jangan git commit -a tetapi git add dulu baru git commit
9. mau udahan coding? git status, git diff dulu, commit yang belum, commit nya pilah2 (7 dan 8), lalu git pull dan git push (3)
10. besok nya ngapain ? git pull dulu yang pertama mah,git status, git diff.

Ganti repo origin dengan yang baru, yang lama di rename
git remote rename origin ngoprek
git remote add origin git@github.com:username_ente/voip-id.git
Setelah itu set default dengan opsi -u untuk diawal saja setelah add repo baru/ganti repo
git push -u origin master
git pull -u origin master

Jika Ingin Tambah repo baru untuk di merge
git remote add mainrepo git@github.com:antonraharja/voip-id.git
git pull mainrepo master
git push
sebelum lanjut coding di local repo

Cek config all
git config -l

Set Up Git Profile

git config –global user.name “Firstname Lastname”
git config –global user.email “your_email@youremail.com”

Integrating git with Sublime Text

https://scotch.io/tutorials/using-git-inside-of-sublime-text-to-improve-workflow

OpenVPN Server and Create Client

apt-get install openvpn openssl
cd /etc/openvpn
cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0 ./easy-rsa
nano easy-rsa/vars

# easy-rsa parameter settings

# NOTE: If you installed from an RPM,
# don’t edit this file in place in
# /usr/share/openvpn/easy-rsa —
# instead, you should copy the whole
# easy-rsa directory to another location
# (such as /etc/openvpn) so that your
# edits will not be wiped out by a future
# OpenVPN package upgrade.

# This variable should point to
# the top level of the easy-rsa
# tree.
export EASY_RSA=”/etc/openvpn/easy-rsa”

#
# This variable should point to
# the requested executables
#
export OPENSSL=”openssl”
export PKCS11TOOL=”pkcs11-tool”
export GREP=”grep”
# This variable should point to
# the openssl.cnf file included
# with easy-rsa.
export KEY_CONFIG=`$EASY_RSA/whichopensslcnf $EASY_RSA`

# Edit this variable to point to
# your soon-to-be-created key
# directory.
#
# WARNING: clean-all will do
# a rm -rf on this directory
# so make sure you define
# it correctly!
export KEY_DIR=”$EASY_RSA/keys”

# Issue rm -rf warning
echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR

# PKCS11 fixes
export PKCS11_MODULE_PATH=”dummy”
export PKCS11_PIN=”dummy”

# Increase this to 2048 if you
# are paranoid. This will slow
# down TLS negotiation performance
# as well as the one-time DH parms
# generation process.
export KEY_SIZE=1024

# In how many days should the root CA key expire?
export CA_EXPIRE=3650

# In how many days should certificates expire?
export KEY_EXPIRE=3650

# These are the default values for fields
# which will be placed in the certificate.
# Don’t leave any of these fields blank.
export KEY_COUNTRY=”ID”
export KEY_PROVINCE=”JB”
export KEY_CITY=”Bandung”
export KEY_ORG=”Astrajingga”
export KEY_EMAIL=”awangga@passionit.co.id”
export KEY_EMAIL=awangga@passionit.co.id
export KEY_CN=kududiganti
export KEY_NAME=kududiganti
export KEY_OU=kududiganti
export PKCS11_MODULE_PATH=kududiganti
export PKCS11_PIN=1234

. ./easy-rsa/vars
./easy-rsa/clean-all
cd easy-rsa
ln -s openssl-1.0.0.cnf openssl.cnf

cd ..
./easy-rsa/build-ca OpenVPN
./easy-rsa/build-key-server server
./easy-rsa/build-key client1
./easy-rsa/build-dh

now create config and copy the files from ./easy-rsa/keys/ or ./easy-rsa/2.0/keys/ to /etc/openvpn

for server :

ca.crt | server.crt | server.key | dh1024.pem

# [server.conf]
port 1194
proto tcp
dev tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/server.crt
key /etc/openvpn/server.key
dh /etc/openvpn/dh1024.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-to-client
keepalive 10 120
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3

for client : ca.crt | client1.crt | client1.key

# [client.conf]
client
dev tun
proto tcp
remote ipaddressofserver 1194
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
mute-replay-warnings
ca ca.crt
cert client1.crt
key client1.key
ns-cert-type server
comp-lzo
verb 3

To create other client just :

. ./easy-rsa/vars

./easy-rsa/build-key client2

Tips Trik Tweak SEO Sederhana untuk Blogger

Tak harus jago SEO untuk bisa mendongkrak pencarian Google kepada situs kita ada beberapa cara yang simple seperti saya referensikan dibawah ini :

1. Editing Template

2. Setting Meta

Laravel Using Gmail SMTP Account Found Error : “Swift_TransportException Cannot send message without a sender address”

Screen Shot 2015-04-26 at 7.51.49 AM

I use gmail for sending every email from my laravel apps, but seriosly there is an error if i go to forgot password or reminder password function.

The solution is just comment out the check conditional in library of swiftmailer

if (!$reversePath = $this->_getReversePath($message)) {
$this->_throwException(new Swift_TransportException(
‘Cannot send message without a sender address’
)
);
}

and add:

$reversePath = $this->_getReversePath($message);

Screen Shot 2015-04-26 at 7.44.35 AM

Reset Password PostgreSQL dan Membuatnya Bisa Diremote

Kadang kita lupa akan password database yang kita buat, di PostgreSQL user rootnya bernama postgre. Tinggal kita edit file g_hba.conf

hanya tinggal ini saja(yang lainnya dikomen dulu):

# TYPE DATABASE USER CIDR-ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
Untuk bisa remote tinggal enable kan di file postgresql.conf
listen_addresses = '*'

Cara Menggunakan IP Public (Publik) Firstmedia / Fastnet

Screen Shot 2015-04-14 at 11.21.15 AM

Perlu diketahui Fastnet atau Firstmedia menyediakan ip publik untuk para pelanggannya, hal ini bisa kita manfaatkan untuk akses ke jaringan rumah kita seperti mengakses CCTV atau server internal. Agar bisa mengaksesnya cukup kita daftarkan diri ke penyedia Dynamic DNS agar IP kita bisa kita remote dan jangan lupa aktifkan port forwarding di modemnya. Satu lagi yang membedakan dengan layanan ISP Telkomspeedy, port forwarding yang bisa digunakan harus diatas port 1000, kalao tidak maka tidak akan pernah bisa kita akses.

Installing Laravel Behind Proxy in Debian Wheezy 7 Linux

If the linux box behind the proxy. You must set terminal environment to use proxy. For curl command, you can ad -x arguments, installation of composer behind proxy is like this :

curl -s https://getcomposer.org/installer -x 192.168.1.5:8888 | php -d detect_unicode=off

and then for downloading laravel package, with php cli, first set env var using commang :

export https_proxy=”http://192.168.1.5:8888″

and then laravel composer create project command

php composer.phar create-project laravel/laravel

 

P.S: 192.168.1.5:8888 is proxy gateway

Solving FreePBX Error Instalation in Debian

Error :

configure: error: *** uuid support not found (this typically means the uuid development package is missing)

apt-get install uuid-dev libjannson-dev

Error :
PHP Fatal error: Cannot make static method DB::connect() non static in class freepbx_db in /var/www/freepbx/admin/libraries/freepbx_DB.php on line 57

pear uninstall db
pear install db-1.7.14

Error :
Module cxpanel successfully downloaded
Failed to install due to the following missing required module(s):<br /><br />manager<br /><br />Unable to install module cxpanel:

/var/lib/asterisk/bin/freepbx_engine: line 748: unexpected EOF while looking for matching `”‘
/var/lib/asterisk/bin/freepbx_engine: line 755: syntax error: unexpected end of file

amportal a ma download manager
amportal a ma install manager

Error :

freepbx blank white

amportal a dbug
amportal a ma delete cxpanel
cp /etc/freepbx.conf /etc/asterisk
chown asterisk:asterisk /etc/asterisk/freepbx.conf

 

OpenSips Error Solving on Debian

Error :

ERROR: No PID file found (/var/run/opensips.pid)! OpenSIPS probably not running

Solution :

chmod a+r /etc/opensips/opensips.cfg

or error in opensips.cfg file

in debian you can check error by

tail -f /var/log/syslog

Ikuti

Kirimkan setiap pos baru ke Kotak Masuk Anda.

Bergabunglah dengan 358 pengikut lainnya.

%d blogger menyukai ini: