Jekyll2023-12-31T15:25:31+00:00https://www.saikiransripada.com/feed.xmlSai Kiran SripadaA software engineer with a strong interest in data structures, algorithms, and back-end development.Sai Kiran SripadaFind similar Instagram hashtags of a keyword2019-08-05T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/find-similar-instagram-hashtags-of-a-keyword<p><a href="https://github.com/saikiransripada/instagram-similar-hashtags" target="_blank">Instagram Similar Hashtags</a> is a command-line script that lists similar hashtags based on the user keyword. No configuration or password required.</p>
<h3 id="requirements">Requirements</h3>
<ul>
<li>Python 3.x</li>
</ul>
<h3 id="usage">Usage</h3>
<ol>
<li>Clone the <a href="https://github.com/saikiransripada/instagram-similar-hashtags" target="_blank">Instagram Similar Hashtags</a> repository to your computer.</li>
<li>Run the script using the command <code class="highlighter-rouge">python3 hashtags.py</code></li>
<li>Enter the hashtag.</li>
</ol>
<p>Please feel free to fork and file issues or create pull requests.
<a href="https://github.com/saikiransripada/instagram-similar-hashtags" target="_blank">https://github.com/saikiransripada/instagram-similar-hashtags</a></p>Sai Kiran SripadaInstagram Similar Hashtags is a command-line script that lists similar hashtags based on the user keyword. No configuration or password required.Download photos, videos, and sidecars from Instagram2019-08-04T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/download-photos-and-videos-from-instagram<p><a href="https://github.com/saikiransripada/instagram-media-downloader" target="_blank">Instagram Media Downloader</a> is a command-line script to download photos, videos and sidecars (album) of an Instagram profile. No configuration or password required. This script works with public profiles only.</p>
<h3 id="requirements">Requirements</h3>
<ul>
<li>Python 3.x</li>
</ul>
<h3 id="usage">Usage</h3>
<ol>
<li>Clone the <a href="https://github.com/saikiransripada/instagram-media-downloader" target="_blank">Instagram Media Downloader</a> repo to your computer.</li>
<li>Install the required packages using <code class="highlighter-rouge">pip3 install -r requirements.txt</code></li>
<li>Run the script using the command <code class="highlighter-rouge">python3 instagram.py -u <instagram_username> -p <path_to_download></code></li>
</ol>
<p>The path parameter is optional. Specify the path if you want to save the media in a specific location. If omitted, it downloads the media to the current working directory.</p>
<p>Please feel free to fork and file issues or create pull requests.
<a href="https://github.com/saikiransripada/instagram-media-downloader" target="_blank">https://github.com/saikiransripada/instagram-media-downloader</a></p>Sai Kiran SripadaInstagram Media Downloader is a command-line script to download photos, videos and sidecars (album) of an Instagram profile. No configuration or password required. This script works with public profiles only.Prevent CNAME file in Jekyll from being deleted during the build process2019-06-29T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/prevent-cname-file-in-jekyll-from-being-deleted-during-the-build-process<p>If you have a custom domain, you may have to copy the CNAME file after every Jekyll build.</p>
<p>You can use the <code class="highlighter-rouge">keep_files</code> option in <code class="highlighter-rouge">_config.yml</code> to prevent the CNAME file in the <code class="highlighter-rouge">_site</code> directory from being deleted during the build process.</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="na">keep_files</span><span class="pi">:</span> <span class="pi">[</span><span class="s1">'</span><span class="s">CNAME'</span><span class="pi">]</span></code></pre></figure>
<p>If you are using Travis CI, you can copy the CNAME file to the <code class="highlighter-rouge">_site</code> directory after the build process. Here’s a sample <code class="highlighter-rouge">.travis.yml</code> configuration that you can use:</p>
<figure class="highlight"><pre><code class="language-yaml" data-lang="yaml"><span class="na">language</span><span class="pi">:</span> <span class="s">ruby</span>
<span class="na">cache</span><span class="pi">:</span> <span class="s">bundler</span>
<span class="na">branches</span><span class="pi">:</span>
<span class="na">only</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">dev</span>
<span class="na">script</span><span class="pi">:</span>
<span class="pi">-</span> <span class="s">JEKYLL_ENV=production bundle exec jekyll build --destination _site</span>
<span class="pi">-</span> <span class="s">cp CNAME ./_site/CNAME</span>
<span class="na">deploy</span><span class="pi">:</span>
<span class="na">provider</span><span class="pi">:</span> <span class="s">pages</span>
<span class="na">local-dir</span><span class="pi">:</span> <span class="s">./_site</span>
<span class="na">target-branch</span><span class="pi">:</span> <span class="s">master</span>
<span class="na">email</span><span class="pi">:</span> <span class="s">deploy@travis-ci.org</span>
<span class="na">name</span><span class="pi">:</span> <span class="s">Deployment Bot</span>
<span class="na">skip-cleanup</span><span class="pi">:</span> <span class="no">true</span>
<span class="na">github-token</span><span class="pi">:</span> <span class="s">$GITHUB_TOKEN</span>
<span class="na">keep-history</span><span class="pi">:</span> <span class="no">true</span>
<span class="na">on</span><span class="pi">:</span>
<span class="na">branch</span><span class="pi">:</span> <span class="s">dev</span></code></pre></figure>Sai Kiran SripadaIf you have a custom domain, you may have to copy the CNAME file after every Jekyll build.Get a notification when the movie tickets are available on BookMyShow2018-11-18T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/get-a-notification-when-the-movie-tickets-are-available-on-bookmyshow<p>This python script checks if movie tickets are available for a showtime and send an email notification. I have written this in <a href="https://www.python.org/" target="_blank">Python 3</a> using <a href="https://www.crummy.com/software/BeautifulSoup/" target="_blank">BeautifulSoup</a>.</p>
<p>Run the script using <code class="highlighter-rouge">python3 app.py</code>.</p>
<p>Please feel free to fork and file issues or create pull requests.
<a href="https://github.com/saikiransripada/bookmyshow" target="_blank">https://github.com/saikiransripada/bookmyshow</a></p>Sai Kiran SripadaThis python script checks if movie tickets are available for a showtime and send an email notification. I have written this in Python 3 using BeautifulSoup.Font from origin has been blocked from loading by Cross-Origin Resource Sharing policy2016-02-19T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/font-from-origin-has-been-blocked-from-loading<p>Custom web fonts via CDN requires CORS (Cross-Origin Resource Sharing) configuration to display fonts properly.</p>
<p>Add the below rule to your .htaccess</p>
<figure class="highlight"><pre><code class="language-apache" data-lang="apache"><span class="c"># Allow access from all domains for webfonts.</span>
<span class="p"><</span><span class="nl">IfModule</span><span class="sr"> mod_headers.c</span><span class="p">>
</span> <span class="p"><</span><span class="nl">FilesMatch</span><span class="sr"> "\.(ttf|ttc|otf|eot|woff|font.css|css)$"</span><span class="p">>
</span> <span class="nc">Header</span> <span class="ss">add</span> Access-Control-Allow-Origin "*"
<span class="p"></</span><span class="nl">FilesMatch</span><span class="p">>
</</span><span class="nl">IfModule</span><span class="p">></span></code></pre></figure>
<p>Using a wildcard is potentially insecure as it opens the domain to JavaScript access from any domain. Instead, you can allow your domain or subdomain.</p>
<figure class="highlight"><pre><code class="language-apache" data-lang="apache"><span class="nc">Header</span> <span class="ss">add</span> Access-Control-Allow-Origin "your-domain.com"</code></pre></figure>
<p>When <code class="highlighter-rouge">add</code> is used, the response header will be added to the existing set of headers; Whereas with <code class="highlighter-rouge">set</code> the response header will be set, replacing any header with this name.</p>Sai Kiran SripadaCustom web fonts via CDN requires CORS (Cross-Origin Resource Sharing) configuration to display fonts properly.Get the file extension in PHP2015-11-24T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/get-the-file-extension-in-php<p>A simple function to get the extension of a file. Meet <a href="https://php.net/pathinfo" target="_blank">pathinfo()</a>.</p>
<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp"><?php</span> <span class="nv">$extension</span> <span class="o">=</span> <span class="nb">pathinfo</span><span class="p">(</span><span class="nv">$filename</span><span class="p">,</span> <span class="nx">PATHINFO_EXTENSION</span><span class="p">);</span> <span class="cp">?></span></code></pre></figure>Sai Kiran SripadaA simple function to get the extension of a file. Meet pathinfo().Always backup your database2015-11-24T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/always-backup-your-database<blockquote>
<p>Always backup your database before playing with it! Better safe than sorry!</p>
</blockquote>Sai Kiran SripadaAlways backup your database before playing with it! Better safe than sorry!Include CSS or JavaScript in Moodle2015-11-20T17:01:27+00:002023-12-23T10:31:26+00:00https://www.saikiransripada.com/include-css-or-javascript-in-moodle<p>When writing a custom plugin, place CSS in a file called styles.css in the base directory of your plugin /plugin/styles.css. Moodle will automatically load the CSS file for you.</p>
<p>To include a CSS file in Moodle:</p>
<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp"><?php</span> <span class="nv">$PAGE</span><span class="o">-></span><span class="na">requires</span><span class="o">-></span><span class="na">css</span><span class="p">(</span><span class="k">new</span> <span class="nx">moodle_url</span><span class="p">(</span><span class="s1">'/path/to/file.css'</span><span class="p">));</span> <span class="cp">?></span></code></pre></figure>
<p>To include a JavaScript file in Moodle:</p>
<figure class="highlight"><pre><code class="language-php" data-lang="php"><span class="cp"><?php</span> <span class="nv">$PAGE</span><span class="o">-></span><span class="na">requires</span><span class="o">-></span><span class="na">js</span><span class="p">(</span><span class="k">new</span> <span class="nx">moodle_url</span><span class="p">(</span><span class="s1">'/path/to/file.js'</span><span class="p">));</span> <span class="cp">?></span></code></pre></figure>
<p>Provide the relative path to the file (excluding document root).</p>
<p>When writing a custom plugin, place CSS in a file called <code class="highlighter-rouge">styles.css</code> in the base directory of your plugin <code class="highlighter-rouge">/plugin/styles.css</code>. Moodle will automatically load the CSS file for you.</p>Sai Kiran SripadaWhen writing a custom plugin, place CSS in a file called styles.css in the base directory of your plugin /plugin/styles.css. Moodle will automatically load the CSS file for you.