Skip to content

Instantly share code, notes, and snippets.

View shahryarjb's full-sized avatar
👐
I am ready for a new job offer and relocation

Shahryar Tavakkoli shahryarjb

👐
I am ready for a new job offer and relocation
View GitHub Profile
defmodule Tasksups.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Supervisor
use Application
def start(_type, _args) do
# List all child processes to be supervised
children = [
def filecreate do
filepath = "/Users/shahryar/Desktop/test/Trangell-2017-09-23-15\:25\:35.918390Z.tar"
File.stream!("#{filepath}", [], 1000000) |> Enum.with_index |> Enum.each(fn chunk ->
{content, index } = chunk
{:ok, file} = File.open("/Users/shahryar/Desktop/test/chunk/back_#{index}.tar", [:write], fn(file) ->
IO.binwrite file, content
end)
end)
end
<a title="آموزش رایگان خوشنویسی با خودکار" href="http://khatoghalam.com/خدمات/طراحی-امضا/entry/1395/86-آموزش-رایگان-خوشنویسی-با-خودکار-%E2%80%8C-خوش-خطی"><img src="http://s8.picofile.com/file/8307094342/757976959_1505947853.gif" alt="آموزش رایگان خوشنویسی با خودکار" width="300" height="250" /></a>
if size_file(path) do
fileuloaded = upload_drive_less_five(path, "#{get_pass_token(email)}")
|> Poison.decode
else
fileuloaded = upload_drive_one_five(path, "#{get_pass_token(email)}")
|> Poison.decode
end
fileuloaded = if size_file(path) do
upload_drive_less_five(path, "#{get_pass_token(email)}")
|> Poison.decode
else
IO.puts "File path not founded"
end
def send_post_to_touch_file(email) do
token = "#{pass_token(email)}"
file = "/Volumes/Untitle/elixir/libeexmp/endgoogledrive_umbrella/apps/endgoogledrive/lib/users/file.txt"
url = "https://www.googleapis.com/drive/v3/files"
file_name = "file.txt"
form = [{:file, "#{file}"},{"name", "#{file_name}"},{"filename", "#{file}"},{"token", "#{token}"},{"uploadType", "media"}]
|> IO.inspect
HTTPoison.post(url , {:multipart, [form]}, ["Authorization", "Bearer #{token}"] ).body |> IO.inspect
end
url = "https://www.googleapis.com/upload/drive/v3/files?uploadType=media"
file = "/Wallpapers/computers-as-knives-14561.png"
file_name = "computers-as-knives-14561.png"
token = "your_token"
HTTPoison.post!(url, {:multipart, [{:file, file, { ["form-data"], [name: "\"file_name\"", filename: "\"file\""]},[]}]}, [], ["Authorization", "Bearer token"])
def gettogoogle() do
url = "https://accounts.google.com/o/oauth2/v2/auth"
# options = Poison.encode!(%{
# "client_id" => "652182638120-27dd7hb47if0f0f12je52ejsqemh81cs.apps.googleusercontent.com",
# "client_secret" => "RDJmLu3YBL_ZF-3b8zvz_hU7",
# "scope" => "https://www.googleapis.com/auth/drive",
# "redirect_uri" => "http://localhost:4000/auth/google/callback",
# "response_type" => "code",
# })
defmodule WithTest do
def ok(x), do: {:ok, x}
def error(x), do: {:error, x}
end
IO.inspect with {:ok, x} <- WithTest.ok(1),
{:ok, y} <- WithTest.ok(2),
do: {:ok, x + y}
IO.puts "----------------------------\n"
defmodule Chat do
use Application
def start(_type, _args) do
Chat.Supervisor.start_link
end
end