George Opritescu

Developer from somewhere

install package only for a user with pip

pip install --user some_package
Read More

httpoison post example

post_body           = %{"events" => shows} |> Poison.encode!
{:ok, response}     = HTTPoison.post(huginn_url, post_body, %{"Content-Type" => "application/json"})
%{status_code: 201} = response
Read More

elixir supervised tasks

Useful information found here

{:ok, tas} = Task.Supervisor.start_link(restart: :transient, max_restarts: 4)
Task.Supervisor.start_child(tas, fn ->
  IO.puts "starting child"
  1 = 2 
end)
Read More

export gitbook as pdf

  • install
    1
    
    gitbook-cli
    by using
    1
    
    npm install -g gitbook-cli
  • install calibre with brew, some variation
    1
    
    brew install Caskroom/cask/calibre
  • go to your gitbook folder and run:
    1
    
    gitbook pdf ./ ./book.pdf
Read More

easy way to copy ssh key to another machine

Install ssh-copy-id by running brew install ssh-copy-id. Then:

ssh-copy-id -p PORT user@some_ip

You need to use PORT if ssh is listening on something other than 22.

Read More
ssh

accessing github over port 443

Added the following to .ssh/config, cause 22 was blocked by the network firewall:

Host github-work
  HostName ssh.github.com
  IdentityFile path_to_key
  User your_username
  Port 443
Read More

WARNING REMOTE HOST IDENTIFICATION HAS CHANGED

If you get this message:

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

when trying to use ssh to login, you can run this command:

ssh-keygen -R </pre>

If ssh-keygen fails, check your `.ssh/known_hosts` file for the entry and delete it.
By the way, do this only if you're sure of what you're doing. The reason I wrote this,
is that I've encountered this message a few times with some VirtualBox machines. 
You might want to double check this ( or probably not do it at all ), if this
happens for a machine connected to the internet ( think staging/prod servers )
Read More
ssh

hive and beeline in cloudera

Quickstart:

  • start beeline
beeline
  • connect
beeline> !connect jdbc:hive2://localhost:10000 username password org.apache.hive.jdbc.HiveDriver
  • to insert data from a local file, the file had to have
    1
    
    755
    permissions on it, and be owned by the user cloudera (?)
  • if it did not have that, I kept getting errors like this:
0: jdbc:hive2://localhost:10000> LOAD DATA LOCAL INPATH '/user/cloudera/employee.txt' overwrite into table employee;
Error: Error while compiling statement: FAILED: SemanticException Line 1:23 Invalid path ''/user/cloudera/employee.txt'': No files matching path file:/user/cloudera/employee.txt (state=42000,code=40000)
Read More

accessing shared folders in VirtualBox

To be able to view the contents of a shared folder in VirtualBox, your user needs to be part of the

1
vboxsf
group:

sudo usermod -a -G vboxsf cloudera

The groups the user is part of do not apply right away. Either login again, or restart the VM for this to take effect.

Read More

gzip file and keep it from being deleted

gzip -k file_to_be_compressed
Read More