Static site generators with Hugo

Static site generators A short guide on how this site was created using hugo. Introduction There are multiple ways of creating of a website, if for example a simple site needs to be created with minimal content and updates a static site might be adequate, however if the site needs a frontend, backend and a database then a dynamic site is required. If the content is the only thing that matters and the content needs to be updated regularly then a static site generator is required. Multiple static site generators are avalable as open source projects, one of them is jeckyll from github and the other is hugo that is optimized for minmal loadtime. ...

November 17, 2023 · 7 min · 1390 words · Aum Pauskar

Database management and SQL

Sql documentation Installation The installation and usage of MySQL can be done in many ways; one is to install WAMP/XAMPP server and using SQL through it another is to use an online sql emulator, the best way is to use a MySQL server. Getting started with MySQL All the operations in SQL can be classified into 3 types DDL: Data definition language includes operation like create, alter, drop DML: Data manipulation language includes operation like select, insert, update, delete DCL: Data control language includes operations like commit, rollback, grant, revoke ...

November 16, 2023 · 10 min · 1996 words · Aum Pauskar

Basic DSA algorithms using C

A complete guide ds Termwork 1 - Infix evaluation Algorithm Create an empty stack (operandStack) to store operands and an empty stack (operatorStack) to store operators. Initialize a variable (result) to store the final output Iterate through each character of the infix expression. If the current character is an operand, add it to the operandStack. If the current character is an operator, pop operators from operatorStack and add them to operandStack until an operator with lower precedence is found. Then push the current operator onto operatorStack. If the current character is an opening parenthesis, push it onto operatorStack If the current character is a closing parenthesis, pop operators from operatorStack and add them to operandStack until an opening parenthesis is found. Repeat steps 3-7 for all characters of the infix expression. Once all characters have been processed, pop any remaining operators from operatorStack and add them to operandStack. Evaluate the final expression in operandStack and return the result. IO 1 2 3 4 5 6 7 8 9 10 11 12 * ➜ programs git:(ds) ✗ gcc tw1.c -lm && ./a.out * Output 1 * Enter the infix expression to evaluate: 5+7-4+3 * 11 * * Output 2 * Enter the infix expression to evaluate: 6+6 * 12 * * Output 3 * Enter the infix expression to evaluate: 4*6^2 * 256 Applications Expression Evaluation: Stacks are commonly used in the evaluation of mathematical expressions, such as infix and postfix expressions. By using a stack, one can easily convert an infix expression to postfix and then evaluate the postfix expression. This is because stacks provide a last-in-first-out (LIFO) data structure, which is well suited for this type of evaluation. Undo/Redo functionality: Stacks can be used to implement undo and redo functionality in applications, such as text editors and image editors. By maintaining a stack of previous states, the application can easily undo and redo actions, by popping and pushing states from the stack. Syntax Checking: Stacks can be used in parsing and syntax checking of programming languages. For example, in a compiler or interpreter, a stack can be used to keep track of the current state of the program being parsed, such as keeping track of matching brackets or keeping track of function calls. This allows for efficient and accurate checking of the syntax of the program, and aids in error handling. Termwork 2 - infix to postfix Algorithm Create an empty stack. Initialize an empty string (result) to store the postfix expression. Iterate through each character of the prefix expression, starting from the rightmost character. If the current character is an operand, append it to the result string. If the current character is an operator, pop the top two elements from the stack and append them to the result string, separated by the current operator. Then, push the current operator onto the stack. Repeat steps 3-5 for all characters of the prefix expression. Once all characters have been processed, pop any remaining operators from the stack and append them to the result string. Reverse the result string and return it as the postfix expression. IO 1 2 3 4 5 6 7 8 9 10 11 12 * ➜ programs git:(ds) ✗ gcc tw2.c && ./a.out * Output 1 * Enter the exp: 4-6+7*7 * 46-77* * * Output 2 * Enter the exp: 7-4+3^5 * 74-35^ * * Output 3 * Enter the exp: 3+5+4 * 35+4+ Applications Same as termwork 1 ...

November 16, 2023 · 24 min · 4913 words · Aum Pauskar

Using i386 IC using Keil uVision5 and Embedded C

Embedded C Embedded C is used in embedded systems and iot deviced such as Arduino and mico IC’s. To emulate this we can use Keil, however this can be only run on Windows, to run this on linux based distros use wine. Procedure to run The following are the steps to run a code on Keil Note: Here we are working on intel 8051AH microcontroller Install and run keil If you are on a windows system you can run the exe file locally, if you are on a linux machine you can run keil through wine and it will function just like you are running it on windows natively. \ Open a new microvision project under the projects tab. Open projects first which is located in the menu bar. Click on open a new micro vision (uVision) project. \ Locate and save the folder in the desired place (with no extension). The prompt will ask you for a cocation where the project needs to be saved. It is always a great practice to always have a new project under a new folder, this makes sure that the project files remain persistant even after making modifications or making a completely new project. \ Create a new file with the extension .c and save the file. Afte completing all the steps given above, open a new wile by using ctrl+n and saving it first with the extension .c, use ctrl+s to save the file. \ Open the startup file on the left hand side and select the add file option. Select the .c file you have created. In order to execute the code that you have written, the software must include it in the environment. To do this first on the left system tray right click and then select add existing files to group and then double select your code base file. \ Translate the file first and then build the file, both the options are available on the menubar. Translating the file changes the embedded c code to assembly level code, then build it to futher convert it into binary code. Select the debug option. In the menubar select debug, the the debug menu select start/stop debug session. This will lead you upto a debug screen. In the debug screen you have to go to the run to run the code normally, or if you have to run/debug it line by line then go to the step button to run/debug it step by step. Under the peripherals tab select the peripherals you require. Unlike other languages keil, the console does not support normal IO. You have to select a peripheral to go along with it. Gain output The output can be traced by the peripheral pins to gain any digital form of output or use analysis window to analyse the function in the analog fasion. Tasks Day 1 Briefing, difference between microprocessor and microcontroller. ...

November 16, 2023 · 4 min · 803 words · Aum Pauskar

Arduino control with peripherals

Arduino 14 IO, 6// ESP 8266 wifi Sketch - name of the program Setup - IO setup Loop - while loop DHT 11 sol moisture SR04 ultrasonic HC05 bluetooth ESP 01 wifi Q. LED blink 1 2 3 4 5 6 7 8 9 10 11 const int ledVar = 13; void setup() { pinMode(ledVar, OUTPUT); } void loop() { digitalWrite(ledVar, HIGH); delay(1000); digitalWrite(ledVar, LOW); delay(1000); } Q. Interface dht 11 with arduino uno and display humidity and temperature on serial monitor 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include <dht.h> dht DHT; #define dhtPin 4 void setup() { Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: int val = DHT.read11(dhtPin); Serial.print("Temprature: "); Serial.println(DHT.temperature); Serial.print("Humidity: "); Serial.println(DHT.humidity); delay(2000); } If else 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 // Q. Interface dht 11 with arduino uno and display humidity and temperature on serial monitor #include <dht.h> dht DHT; #define dhtPin 4 const int ledVar = 13; void setup() { Serial.begin(9600); pinMode(ledVar, OUTPUT); } void loop() { // put your main code here, to run repeatedly: int val = DHT.read11(dhtPin); Serial.print("Temprature: "); // float temp = DHT.temperature; if ( DHT.temperature > 25.00) { digitalWrite(ledVar, HIGH); } else { digitalWrite(ledVar, LOW); } Serial.println(DHT.temperature); Serial.print("Humidity: "); Serial.println(DHT.humidity); delay(2000); } Button operation 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 const char led1 = A5; const char led2 = A4; const char led3 = A3; const char led4 = A2; const int b1 = 13; const int b2 = 12; const int b3 = 11; const int b4 = 10; int buttonState1, buttonState2, buttonState3, buttonState4; void setup() { // put your setup code here, to run once: pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(led4, OUTPUT); pinMode(b1, INPUT); pinMode(b2, INPUT); pinMode(b3, INPUT); pinMode(b4, INPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedl if (digitalRead(b1) == LOW) { digitalWrite(led1, HIGH); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); } else if (digitalRead(b2) == LOW){ digitalWrite(led1, LOW); digitalWrite(led2, HIGH); digitalWrite(led3, LOW); digitalWrite(led4, LOW); } else if (digitalRead(b3) == LOW){ digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, HIGH); digitalWrite(led4, LOW); } else if (digitalRead(b4) == LOW){ digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, HIGH); } else { digitalWrite(led1, LOW); digitalWrite(led2, LOW); digitalWrite(led3, LOW); digitalWrite(led4, LOW); } } LCD 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include <LiquidCrystal.h> const int rs = 6, en = 7, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); void setup() { lcd.begin(16,2); lcd.print(" Hello "); lcd.setCursor(0,1); lcd.print(" World "); } void loop() { // put your main code here, to run repeatedly: lcd.noDisplay(); lcd.display(); delay(5000); } IoT internship project 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 /*Problem statement Interface LCD with Arduino Uno to display the right to left scrolling message IoT Internship */ // title, problem statement, onjective, components, interfacing block diagram // libraries #include <LiquidCrystal.h> // programming constants const int rs = 6, en = 7, d4 = 5, d5 = 4, d6 = 3, d7 = 2; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); int initialDelay = 1000; int pixelDelay = 300; char message[] = "IoT Internship"; void setup() { lcd.begin(16, 2); lcd.print(message); delay(initialDelay); } void loop() { // given count values to properly scroll through the screen for (int positionCounter = 0; positionCounter < 13; positionCounter++) { lcd.scrollDisplayLeft(); delay(pixelDelay); } for (int positionCounter = 0; positionCounter < 29; positionCounter++) { lcd.scrollDisplayRight(); delay(pixelDelay); } for (int positionCounter = 0; positionCounter < 16; positionCounter++) { lcd.scrollDisplayLeft(); delay(pixelDelay); } delay(1000); }

November 16, 2023 · 4 min · 707 words · Aum Pauskar