Monday, August 1, 2016

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

I try it with nginx log, the result is look good. :)

Thursday, March 24, 2016

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


Friday, October 2, 2015

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

Wednesday, September 2, 2015

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               # Executes the given command
mix compile           # Compile source files
mix deps              # List dependencies and their status
mix deps.clean        # Remove the given dependencies' files
mix deps.compile      # Compile dependencies
mix deps.get          # Get all out of date dependencies
mix deps.unlock       # Unlock the given dependencies
mix deps.update       # Update the given dependencies
mix do                # Executes the tasks separated by comma
mix escript.build     # Builds an escript for the project
mix help              # Print help information for tasks
mix hex               # Print hex help information
mix hex.config        # Read or update hex config
mix hex.docs          # Publish docs for package
mix hex.info          # Print hex information
mix hex.key           # Hex API key tasks
mix hex.outdated      # Shows outdated hex deps for the current project
mix hex.owner         # Hex package ownership tasks
mix hex.publish       # Publish a new package version
mix hex.search        # Search for package names
mix hex.user          # Hex user tasks
mix loadconfig        # Loads and persists the given configuration
mix local             # List local tasks
mix local.hex         # Install hex locally
mix local.rebar       # Install rebar locally
mix new               # Create a new Elixir project
mix phoenix.new       # Create a new Phoenix v0.17.0 application
mix run               # Run the given file or expression
mix test              # Run a project's tests
iex -S mix            # Start IEx and run the default task



Then you see a list of tasks that we can play with, next post

Friday, June 12, 2015

Using "wget" to check web server status

Please use this

# wget -O - | grep

-O : indicate output filename
- : send content to std output

ref www.terminalinflection.com/using-wget-to-test-web-server-connectivity/

Tuesday, June 9, 2015

Backup my kubuntu 14.10 settings


Before I get other machine, I want to thank to my x230, you're so cool!!!
  • Style
    • widget style : QtCurve
  • Icon
    • theme : numix circle
  • Font
    • liberation
    • use anti-aliasing : enabled
    • use sub-pixel  rendering : RGB
    • hinting-style : slight
  • Window Decorations
    • QtCurve
  • Desktop Theme
    • Glaze