Skip to content

Instantly share code, notes, and snippets.

@sd031
sd031 / Learn Linux Basics | part 5: Shell Scripting functions
Last active June 8, 2025 22:03
Learn Linux Basics | part 5: Shell Scripting functions
Funtions:
Writing Functions:
Normal function:
get_name() {
echo "John"
}
echo "You are $(get_name)"
@sd031
sd031 / Making Basic Docker Image from project using Dockerfile
Last active June 8, 2025 22:03
Building a Basic Docker Image Using Dockerfile
Dockerizing Any Application Using Dockerfile - Full Step by Step Process to make docker image:
What is the Dockerfile?
Dockerfiles are instructions. They contains all of the commands used to build an image.
Docker images consist of read-only layers.
Each represents a Dockerfile instruction.
Layers are stacked.
Each layer is a result of the changes from the previous layer.
Images are built using the docker image build command.
@sd031
sd031 / Learn Linux Basics | part 4: Basic Shell Scripting
Last active May 19, 2021 00:19
This Gist contains basic shell scripting and their meaning, this gist's sole purpose is to help students learn basic file management commands.
Basic Linux Shell Scripting:
What is Shell?
The shell executes a program in response to its prompt. When you give a command, the shell searches for the program, and then executes it. For example, when you give the command ls, the shell searches for the utility/program named ls, and then runs it in the shell. The arguments and the options that you provide with the utilities can impact the result that you get. The shell is also known as a CLI, or command line interface.
Types of shells:
Primaryly there is two types of shell:
Bourne shell − If you are using a Bourne-type shell, the $ character is the default prompt.
It has sub categories: Bourne shell (sh), Korn shell (ksh), Bourne Again shell (bash), POSIX shell (sh)
@sd031
sd031 / Learn Linux Basics | Part 3: Basic Linux Utilities and System information related commands
Created September 5, 2019 12:13
This Gist contains Basic Linux Utilities and System information related commands and their meaning, this gist's sole purpose is to help students learn basic file management commands.
@sd031
sd031 / Linux Series part 2: File & Folder Permission Management.txt
Last active May 30, 2023 12:51
This Gist contains basics Linux File & Folder Permission Management Commands and their meaning, this gist's sole purpose is to help students learn basic file management commands.
Linux Series part 2: File & Folder Permission Management:
To see file list, their crrent permission level and much more, you can run:
ls -la -lh -lt
(To know more on ls commands check tutorial: https://www.youtube.com/watch?v=h6sDtGN5hYs)
chmod <specification> filename : Change the file permissions. Specifications = u user/owner, g group, o other, + add permission, - remove, r read, w write,x execute.
chmod -R <specification> dir-name: Change the permissions of a directory recursively. To change permission of a directory and everything within that directory, use this command.
@IvanIsCoding
IvanIsCoding / a.cpp
Last active October 21, 2023 09:07
Educational Dynamic Programming Contest - AtCoder
// Ivan Carvalho
// Problem A - Educational Dynamic Programming Contest - AtCoder
// Link : https://atcoder.jp/contests/dp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int INF = 2*1e9;
int dp[MAXN],N,K,h[MAXN];
@filipeximenes
filipeximenes / multiple_db_querying.py
Last active May 11, 2020 08:28
Multitenancy post code examples
spinners = (
Spinner.objects
.using(request.customer.name)
.annotate(
avg_duration=Avg('owned_spinners__spins__duration'))
.order_by('-avg_duration'))
from buckets.fields import S3FileField
from datetime import datetime, timezone, timedelta
from django.conf import settings
from django.db import models
from django.dispatch import receiver
from django.utils.translation import ugettext as _
from django.core.mail import send_mail
from django.template.loader import render_to_string
import django.contrib.auth.models as auth
import django.contrib.auth.base_user as auth_base
@nikhita
nikhita / update-golang.md
Last active November 17, 2025 00:14
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by: