Skip to content

Instantly share code, notes, and snippets.


Aswin C officialcjunior

View GitHub Profile
officialcjunior /
Created Jul 11, 2021
Implementation of a singly linked list in Rust using smart pointers(Box)
use std::fmt;
use std::io;
// Since, we don't have `NULL` in Rust, we will use Option for
// each of the smart pointers- `Box`es. Basically, each of the Node contains a
// Some() or a None()
struct Node {
value: u32,
next: Option<Box<Node>>,
officialcjunior /
Created Jan 1, 2021
Python script to find the minimize unimodal expressions using the golden section method | optimization technique
import math
invphi = (math.sqrt(5) - 1) / 2 # 1 / phi
invphi2 = (3 - math.sqrt(5)) / 2 # 1 / phi^2 ig
def gssrec(f, a, b, tol=1e-5, h=None, c=None, d=None, fc=None, fd=None):
(a, b) = (min(a, b), max(a, b))
if h is None: h = b - a
if h <= tol: return (a, b)
officialcjunior /
Created Jan 1, 2021
Python script to minimize unimodal expressions using Fibonacci method
import math
def fibu(n):
if n <= 1:
return n
return(fibu(n-1) + fibu(n-2))
#for i in range (10):
# print (i-1, ",", fibu(i))
officialcjunior /
Created Sep 21, 2020
I use this script to sync my fork with the upstream (original repo).
# fetches the new stuff from upstream. I hope you've added the link to the original repo as 'upstream'
git fetch upstream
git checkout master
# prunes unwanted branches
git fetch --all --prune
# merges without your master
officialcjunior /
Last active Oct 9, 2021
A small how-to on installing frama-c, the source code analyzer on Unix systems.

How to install frama-c on *nix

I had wasted almost half of a day trying to properly install frama-c on my Linux. I was surprised to see no much documentation or troubleshooting online, so that's the whole point of me putting this note as a public gist.


If you read the official documentation, you'll come across the names of these two packages:

frama-c and frama-c-base

If you are on Ubuntu 18.04 LTS, you can directly install it using apt install frama-c, and it will work. You can not do this on a 20.04 LTS Focal Fossa, because apparently, it's not included in the official packages.

officialcjunior /
Created Jul 21, 2020
A simple python script to calculate voltages and currents when using voltage divider bias. Can be useful when trying to find the DC Load Line. Here, I went with hardcoding the values, as passing by arguments can be difficult in unfortunate times.
#0.7 for Silicon and 0.3 for Germanium diodes
rb= #*10**3
#put rb=0, if rb isn't there. same for all
officialcjunior /
Created May 31, 2020 posts a shitpost on Mastodon.
# Requirements : Toot and a Unix-like system
import urllib.request
import random
import subprocess
word_url = ""
response = urllib.request.urlopen(word_url)
officialcjunior /
Last active May 31, 2020
Create a Merge Reqest in Gitlab from the terminal.
import subprocess
import os
branch_name=input("Enter the target branch name, I mean, => target-repository:")
title=input("Enter the title or the Merge Request\n")
description=input("Enter description \n")
bool_origin=input("Is this branch already added in remote? (y/n) \n")
if bool_origin=='n':
origin = input("Input the branch name \n")
officialcjunior / 1244B.c
Created Mar 24, 2020
Solution to 1244B of the codeforces problemset
View 1244B.c
#include <stdio.h>
int main()
int t, n, max, i;
scanf("%d",&t); // test cases
scanf("%d",&n); // n=number of rooms
char s[n+1];


This script is to download all the songs released by the Indian alternative rock band Avial, in the highest quality possible.

Track list

  • All the songs from the studio album Avial(2008)
  • All the four singles : Aanakallan, Ayyo!, Thithithara, Arambath
  • "Chi Me Sape"- The song born after collaborating with Italian band A67.