Posts

Showing posts from March, 2018

How do you interpolate strings in Elixir?

How do you interpolate strings in Elixir? You use #{} in strings to add in elixir  iex> IO.puts "Hello #{:world}" 

What are booleans in Elixir?

What are booleans in Elixir? Booleans are actually Elixir atoms

What are boolean values in Elixir?

What are boolean values in Elixir? The two boolean values are: iex> true true iex> false false

How many ways can I write numbers in Elixir?

How many ways can I write numbers in Elixir? You can write them in: Decimal Binary Octal Hexadecimal iex> 1.0 1.0 iex> 10 10 iex> 0b1010 10 iex> 0o777 511 iex> 0x1F 31

Where can I ask questions about Elixir?

Where can I ask questions about Elixir? You can ask on: IRC: #elixir-lang at freenode IRC Slack: https://elixir-slackin.herokuapp.com/ Elixir Forum: https://elixirforum.com/ Stackoverflow: https://stackoverflow.com/questions/tagged/elixir

How do I run a elixir script?

How do I run a elixir script? Type in a file: IO.puts "Hello World!" Then execute: $ elixir simple.exs

How do I print output in Elixir?

How do I print output in Elixir? IO.puts "Hello World!"

What types does elixir have?

Elixir data types: iex> 1 # integer iex> 1.0 # float iex> true # boolean iex> :atom # atom / symbol iex> "elixir" # string iex> [1, 2, 3] # list iex> {1, 2, 3} # tuple iex> sum = fn ( a , b ) -> a + b end # tuple iex> kw_list = [{:one, 1}, {:two, 2}] # keyword list iex> map = %{:a => 1, 2 => :b} # map

How do you get UTF-8 in Elixir?

How do you get UTF-8 in Elixir? All the strings in Elixir are already UTF-8

How do I find the version of elixir is installed?

How do I find the version of elixir is installed? Type: $ elixir -v

How do I install Elixir on a Mac?

How do I install Elixir on a Mac? The easiest was is to use brew $ brew install elixir  Reference:  https://elixir-lang.org/install.html#mac-os-x

How do I start Elixir?

type: $ iex

Rsync - a great tool

If you haven't used rsync yet you should. It's a great tool for mirroring http://www.samba.org/rsync/

Vi paging up and paging down

In vi to page up and down type Ctrl-b aka (^b) Ctrl-f aka (^f)

End of line characters

Global Search and Replace : The magic command is :line1,line2s/old_string/new_string/g The /g is optional, it means 'do the replace everytime'.If not specified, vi will replace only the first occurrence in each line. Special ^XX characters To search for a ^XX character, you must use Ctrl - v ( ^v ) in order to disable interpretation of the Ctrl commands. A useful example: Windows (MS-DOS) text files use RETURN/LINEFEED to end every line; Mac uses only RETURN; and Unix/Linux uses only NEWLINE (which is the same as the linefeed in DOS). To use the linux programming style: \r\n = chr(13)chr(10) = MS-DOS \r = chr(13) = Mac \n = chr(10) = Linux/Unix So when displaying an msdos ascii file with vi (or with any other text editor), you will find each and every line ended by a ^M (it's character 13, aka \r, aka ENTER). When displaying a mac as

How do I type the end of file character

The end of file character is different on different operating systems so the end of line aka eof is: Control-D on Unix Control-Z on Windows

How do I get UTC time in seconds in oracle sql

Timestamps can be confusing and difficult to work with in oracle. It took me a little time to figure out but the following SQL will give you SELECT (CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE) - TO_DATE('19700101', 'YYYYMMDD')) * 86400 seconds , current_timestamp FROM dual the UTC time in seconds from the epoch, as a floating point number. 60 * 60 * 24 for 60 seconds * 60 minutes * 24 hours = 86400

Perl loop through days code

Here is some code for looping through days http://datetime.perl.org/index.cgi?FAQSampleCalculations http://datetime.perl.org/index.cgi?FAQBasicUsage #!/bin/env perl use DateTime; my $start_dt = DateTime->new(year => 2009, month => 4, day => 27); my $end_dt = DateTime->new(year => 2009, month => 5, day => 18); my $weeks = 0; for (my $dt = $start_dt->clone(); $dt <= $end_dt; $dt->add(days => 1) ) { print $dt->date('')."\n"; $weeks++; }

Vi paging up and paging down

In vi to page up and down type Ctrl-b (^b) Ctrl-f (^f)

How to escape single quotes bash

Just use my web page that I setup to escape single quotes in bash http://www.stevemorin.com/utils/bashEscape.html

sbcl lisp access command line arguments

$ sbcl --eval '(progn (print *posix-argv*)(quit))' two three