<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Shrey Tripathi</title>
    <description>The latest articles on Forem by Shrey Tripathi (@shrey27tri01).</description>
    <link>https://forem.com/shrey27tri01</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F244515%2F4521fe1d-1472-4b83-9faa-e4fa5c163366.jpeg</url>
      <title>Forem: Shrey Tripathi</title>
      <link>https://forem.com/shrey27tri01</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shrey27tri01"/>
    <language>en</language>
    <item>
      <title>My first ever Github Action!</title>
      <dc:creator>Shrey Tripathi</dc:creator>
      <pubDate>Wed, 16 Sep 2020 12:34:14 +0000</pubDate>
      <link>https://forem.com/shrey27tri01/my-first-ever-github-action-1lh4</link>
      <guid>https://forem.com/shrey27tri01/my-first-ever-github-action-1lh4</guid>
      <description>&lt;p&gt;This was my first ever encounter with any Github Action, so I have made a pretty basic workflow 😅.&lt;/p&gt;

&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;I built upon the existing &lt;a href="https://docs.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions"&gt;python action&lt;/a&gt; to make sure that any user who merges to the &lt;code&gt;master&lt;/code&gt; branch or creates a Pull Request to the &lt;code&gt;master&lt;/code&gt; branch has to pass through the tests that have been built in the Django application.&lt;br&gt;
This also makes sure that the code changed through the commit or PR also runs on the correct python version and does not break the existing code.&lt;/p&gt;
&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Wacky Wildcards&lt;/p&gt;
&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/shrey27tri01"&gt;
        shrey27tri01
      &lt;/a&gt; / &lt;a href="https://github.com/shrey27tri01/just-post-it"&gt;
        just-post-it
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
just-post-it&lt;/h1&gt;
&lt;p&gt;just-post-it is a very basic twitter-like social network application made in django, pure javascript, HTML and CSS.&lt;/p&gt;
&lt;p&gt;Current functionalities are: posting, liking, unliking, following and unfollowing users, viewing all posts made ever, viewing posts made by the user you follow, and editing already made posts.&lt;/p&gt;
&lt;p&gt;More functionalities to come soon!!&lt;/p&gt;
&lt;p&gt;To run locally, run the following commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;git clone https://github.com/shrey27tri01/just-post-it.git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cd just-post-it&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Activate virtual environment following the guide &lt;a href="https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment" rel="nofollow"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;python(3) manage.py runserver&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/shrey27tri01/just-post-it"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
 

&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;Existing actions I have used: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/actions"&gt;
        actions
      &lt;/a&gt; / &lt;a href="https://github.com/actions/checkout"&gt;
        checkout
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Action for checking out a repo
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;p&gt;
  &lt;a href="https://github.com/actions/checkout"&gt;&lt;img alt="GitHub Actions status" src="https://res.cloudinary.com/practicaldev/image/fetch/s--gbcqZPto--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/actions/checkout/workflows/test-local/badge.svg"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h1&gt;
Checkout V2&lt;/h1&gt;
&lt;p&gt;This action checks-out your repository under &lt;code&gt;$GITHUB_WORKSPACE&lt;/code&gt;, so your workflow can access it.&lt;/p&gt;
&lt;p&gt;Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. Set &lt;code&gt;fetch-depth: 0&lt;/code&gt; to fetch all history for all branches and tags. Refer &lt;a href="https://help.github.com/en/articles/events-that-trigger-workflows"&gt;here&lt;/a&gt; to learn which commit &lt;code&gt;$GITHUB_SHA&lt;/code&gt; points to for different events.&lt;/p&gt;
&lt;p&gt;The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set &lt;code&gt;persist-credentials: false&lt;/code&gt; to opt-out.&lt;/p&gt;
&lt;p&gt;When Git 2.18 or higher is not in your PATH, falls back to the REST API to download the files.&lt;/p&gt;
&lt;h1&gt;
What's new&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Improved performance
&lt;ul&gt;
&lt;li&gt;Fetches only a single commit by default&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Script authenticated git commands

&lt;ul&gt;
&lt;li&gt;Auth token persisted in the local git config&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Supports SSH&lt;/li&gt;
&lt;li&gt;Creates a local branch

&lt;ul&gt;
&lt;li&gt;No longer detached HEAD when checking out a branch&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Improved layout

&lt;ul&gt;
&lt;li&gt;The input &lt;code&gt;path&lt;/code&gt; is…&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/actions/checkout"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div class="ltag-github-readme-tag"&gt;
&lt;br&gt;
  &lt;div class="readme-overview"&gt;
&lt;br&gt;
    &lt;h2&gt;
&lt;br&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;&lt;br&gt;
      &lt;a href="https://github.com/actions"&gt;&lt;br&gt;
        actions&lt;br&gt;
      &lt;/a&gt; / &lt;a href="https://github.com/actions/setup-python"&gt;&lt;br&gt;
        setup-python&lt;br&gt;
      &lt;/a&gt;&lt;br&gt;
    &lt;/h2&gt;
&lt;br&gt;
    &lt;h3&gt;
&lt;br&gt;
      Set up your GitHub Actions workflow with a specific version of python&lt;br&gt;
    &lt;/h3&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="ltag-github-body"&gt;
&lt;br&gt;
    

&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
setup-python V2&lt;/h1&gt;
&lt;p&gt;
  &lt;a href="https://github.com/actions/setup-python"&gt;&lt;img alt="GitHub Actions status" src="https://res.cloudinary.com/practicaldev/image/fetch/s--zbknHD4V--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/actions/setup-python/workflows/Main%2520workflow/badge.svg"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;This action sets up a Python environment for use in actions by:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;optionally installing and adding to PATH a version of Python that is already installed in the tools cache&lt;/li&gt;
&lt;li&gt;downloading, installing and adding to PATH an available version of Python from GitHub Releases (&lt;a href="https://github.com/actions/python-versions/releases"&gt;actions/python-versions&lt;/a&gt;) if a specific version is not available in the tools cache&lt;/li&gt;
&lt;li&gt;failing if a specific version of Python is not preinstalled or available for download&lt;/li&gt;
&lt;li&gt;registering problem matchers for error output&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
What's new&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Ability to download, install and set up Python packages from &lt;code&gt;actions/python-versions&lt;/code&gt; that do not come preinstalled on runners
&lt;ul&gt;
&lt;li&gt;Allows for pinning to a specific patch version of Python without the worry of it ever being removed or changed&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Automatic setup and download of Python packages if using a self-hosted runner&lt;/li&gt;
&lt;li&gt;Support for pre-release versions of Python&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
Usage&lt;/h1&gt;
&lt;p&gt;See &lt;a href="https://raw.githubusercontent.com/actions/setup-python/main/action.yml"&gt;action.yml&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Basic:&lt;/p&gt;
&lt;div class="highlight highlight-source-yaml"&gt;
&lt;pre&gt;&lt;span class="pl-ent"&gt;steps&lt;/span&gt;
- &lt;span class="pl-ent"&gt;uses&lt;/span&gt;: &lt;span class="pl-s"&gt;actions/checkout@v2&lt;/span&gt;
- &lt;span class="pl-ent"&gt;uses&lt;/span&gt;&lt;/pre&gt;…&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/actions/setup-python"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>actionshackathon</category>
      <category>django</category>
      <category>github</category>
    </item>
    <item>
      <title>Time limit excedeed error for large values</title>
      <dc:creator>Shrey Tripathi</dc:creator>
      <pubDate>Mon, 06 Apr 2020 07:20:42 +0000</pubDate>
      <link>https://forem.com/shrey27tri01/time-limit-excedeed-error-for-large-values-2k1p</link>
      <guid>https://forem.com/shrey27tri01/time-limit-excedeed-error-for-large-values-2k1p</guid>
      <description>&lt;p&gt;I have been given x and k, where x is the number of factors of a number A, and k is the number of prime factors of A. Given x and k, I have to find out whether such an A exists.&lt;br&gt;
For example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INPUT : 4 2 
OUTPUT : 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Since 6 is a number that has 4 factors 1, 2, 3, 6 out of which 2 are prime(2, 3).&lt;br&gt;
Also it is given that x and k can have any values between 1 and 10^9.&lt;br&gt;
Here is my code for the same :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;long long int x, k;
scanf("%lld%lld", &amp;amp;x, &amp;amp;k);

int ans = 0;

bool stop = false;

for(long long int numbers=1; numbers&amp;lt;pow(10, 9) &amp;amp;&amp;amp; !stop; numbers++)
{
    long long int noOfFactors = 0, noOfPrimes = 0;
    for(long long int a=1; a&amp;lt;=numbers &amp;amp;&amp;amp; !stop; a++)
    {
        if(numbers%a == 0)
        {
            noOfFactors += 1;
            if((isprime(a)) == 1)
            {
                noOfPrimes += 1;
            }
         }
     }
     if(noOfFactors == x &amp;amp;&amp;amp; noOfPrimes == k )
     {
         ans = 1;
         stop = true;
     }
     else ans = 0;
}   
printf("%d\n", ans);

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Where isprime(x) returns 1 if x is prime else 0. &lt;/p&gt;

&lt;p&gt;But while running the program, it shows TLE error.&lt;br&gt;
Can anyone help me out in optimising this algorithm, or if any other method exists, can you just explain it to me ?&lt;br&gt;
Any help in optimising this algorithm or using another method would be kindly appreciated.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
