Skip to content

Instantly share code, notes, and snippets.

View TwistingTwists's full-sized avatar
💭
Elixir dev

Abhishek Tripathi TwistingTwists

💭
Elixir dev
View GitHub Profile
@TwistingTwists
TwistingTwists / serde_alias_test.rs
Created July 28, 2024 14:13
testing alias properties of serde
use std::hash::{Hash, Hasher};
use serde::Deserialize;
use serde::Serialize;
#[derive(Debug, Deserialize, Serialize)]
pub struct TunTun{
pub two: MyStruct,
// #[serde( alias = "two")]
// pub two_1: MyStruct
defmodule RazorNewWeb.S3Writer do
@moduledoc """
Module to stream video directly to S3 bucket.
But not via presigned url.
"""
use TypedStruct
@typedoc "S3Writer struct"
typedstruct do
@TwistingTwists
TwistingTwists / github_bitbucket_multiple_ssh_keys.md
Created June 10, 2024 03:49 — forked from yinzara/github_bitbucket_multiple_ssh_keys.md
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@TwistingTwists
TwistingTwists / json_schema.ex
Last active February 11, 2024 06:00
instructor json schema
%{
"$defs" => %{
"Politician.Office" => %{
"description" => "",
"properties" => %{
"from_date" => %{"format" => "date", "title" => "from_date", "type" => "string"},
"office" => %{
"enum" => ["president", "vice_president", "governor", "congress", "senate"],
"title" => "office",
{
:error,
%Ash.Error.Invalid{
__exception__: true,
changeset: #Ash.Changeset<api: PyqRatta.Databank, action_type: :update, action: :update_quiz_with_question_ids, attributes: %{}, relationships: %{questions: [{[%{id: "1085ee61-68b6-4bb8-ad7c-375b7129443f"}, %{id: "d86052e1-8feb-420b-92ce-17f5d35d9c07"}], [ignore?: false, on_missing: :ignore, on_match: :ignore, on_lookup: :relate, on_no_match: :error, eager_validate_with: false, authorize?: true, meta: [inputs_was_list?: true, id: :question_ids], type: :append]}]}, arguments: %{question_ids: ["1085ee61-68b6-4bb8-ad7c-375b7129443f", "d86052e1-8feb-420b-92ce-17f5d35d9c07"]}, errors: [%Ash.Error.Invalid{errors: [%Ash.Error.Query.Required{field: :question_id, type: :argument, resource: PyqRatta.Databank.Question, changeset: nil, query: nil, error_context: [], vars: [], path: [], stacktrace: #Stacktrace<>, class: :invalid}], stacktraces?: true, changeset: nil, query: #Ash.Query<resource: PyqRatta.Databank.

Here are the few questions we will answer in the talk.

  1. Why do you need concurrency at all?
  2. What is difference between concurrency and async programming? Are not those two things same?
  3. When do you need async? Language level vs library level features.
  4. Composing futures
  5. What makes concurrency hard?
  6. Models of thread based concurrency?
  7. Actor based models of concurrency - Elixir / Scala
defmodule RazorNewWeb.RemoteUploadLive do
use RazorNewWeb, :live_view
@defaults %{
# default params for upload in liveview
# 4000 MB
max_file_size: 4000 * 1000 * 1000,
chunk_size: 640 * 1000 * 3,
accept_upload_types: ~w( .mp4 ),
Dockerizing a Django project involves creating a Docker container for your application, which can help streamline deployment and ensure consistent environments. Here's a step-by-step guide on how to Dockerize a Django project:
Install Docker: First, make sure you have Docker installed on your system. You can download it from the official Docker website: https://www.docker.com/get-started
Create a Dockerfile: In your Django project's root directory, create a new file named Dockerfile. This file will contain instructions to build a Docker image for your project.
Add the following content to your Dockerfile:
Dockerfile
Copy code