Posts

Changing postgres password and warning

ORIGINAL from https://serverfault.com/questions/110154/whats-the-default-superuser-username-password-for-postgres-after-a-new-install
CAUTION The answer about changing the UNIX password for "postgres" through "$ sudo passwd postgres" is not preferred, and can even be DANGEROUS! This is why: By default, the UNIX account "postgres" is locked, which means it cannot be logged in using a password. If you use "sudo passwd postgres", the account is immediately unlocked. Worse, if you set the password to something weak, like "postgres", then you are exposed to a great security danger. For example, there are a number of bots out there trying the username/password combo "postgres/postgres" to log into your UNIX system. What you should do is follow Chris James's answer: sudo -u postgres psql postgres # \password postgres Enter new password: To explain it a little bit. There are usually two default ways to login to PostgreSQL serve…
Hi Everyone :)

I just beginning new post in new year with Xubuntu fresh installed on X260. A bit of problems around. This post will relate to one problem I found recently.

Problem:
  I cannot bring bring `brightness` back after return from suspend.

Summarize solutions:
  1.1. Create this file by command `sudo touch /usr/share/X11/xorg.conf.d/20-intel.conf`
  1.2. Add this to file
Section "Device"
        Identifier  "card0"
        Driver      "intel"
        Option      "Backlight"  "intel_backlight"
        BusID       "PCI:0:2:0"
EndSection   1.3. Restart or may be logout and login
  2.1. Edit this file by command `sudo vi /etc/default/grub`   2.2. Modify previous to with this
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux apci_backlight=vendor"   2.3. We should restart, i guess
Finally, I still don't know if it work, but hey, right now it's fine for me

Cool bash command for summary bot visited

I just found quite cool bash combination

cat test.log | awk -F\" '{print $6}' | sort | uniq -c | sort -n
from this http://www.blogtips.org/web-crawlers-love-the-good-but-kill-the-bad-and-the-ugly/ I try it with nginx log, the result is look good. :)

Reupload stuff to S3 with aws cli

Hi, my friend.

    Today I have done some stuff using aws cli. It's quite a good tools beside python+boto. My task in this period is about devops+dev :p. So currently I created some image migrate script in python. It is for reprocess an images using Imagemagick. Then it need to be upload to S3. The accident is about I forget to assign ACL for all images before upload to S3. User cannot see ours images. I try some stuff from google then I realize that I never try linux:touch command before. And It works. I use command
>> aws s3 sync . s3://mybucket --dryrun
to check if tools can reupload for me. :)

Luck is on my side now!!!. So I just
>> find . -name 'xxx.yyy' | xargs touch 
and
>> aws s3 sync . s3://mybucket --acl public-read
Finally. Yeah, Shit Done!!!!

Next Post I will describe about my python script + imagemagick


Create new user with sudo permission

Usecase: I install linux without GUI ( so it didn't provide ubuntu user ). If I want to have another with sudo permission.
Let's try this

be root or user with root permission
>> adduser sudo

because in sudoer file, said Any user in group sudo, will have permission to use sudo command
ref: http://askubuntu.com/questions/7477/how-can-i-add-a-new-user-as-sudoer-using-the-command-line

Release with exrm in Elixir

Hi All :)

I'm using exrm (https://github.com/bitwalker/exrm) for releasing process. It's quite nice library. Even I don't actually know what it done behind (digging it now).

Notice that some important issue is about if your application cannot start because some thing or function is invalid or cannot not load but you sure that you put it in mix.exs in deps list. So this https://exrm.readme.io/docs/common-issues will inform us to put it in mix.exs in applications list, too.

Even i don't understand why, because in elixir's doc of mix's topic said if app implemented by use "Application" behaviour. They should be put in mix.exs application list. But chronos's code doesn't seem to implement with "Application" behaviour. Anyway i tried put it in that list, and its work!!.

The beginning of my's Elixir

Introduction
I just start new job. All work I assigned about elixir. Currently, i'm working on replacing rail's service with elixir( use phoenix framework as api endpoint ). It's quite good now because I came from python's background.

Elixir 's Installation
- We need erlang installed
[linux] sudo apt-get install erlang
[osx] brew install erlang

Then

[linux] Goto https://www.erlang-solutions.com/downloads/download-elixir, you may download deb file for ubuntu or whatever distro you have.
[osx] brew install elixir [ping me, if i'm wrong :p]

If you come to this line, let's
>> mix help
mix                   # Run the default task (current: mix run)
mix app.start         # Start all registered apps
mix archive           # List all archives
mix archive.build     # Archive this project into a .ez file
mix archive.install   # Install an archive locally
mix archive.uninstall # Uninstall archives
mix clean             # Delete generated application files
mix cmd …