This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Hello World" # this function append a new line character | |
print "Hello World" # this function doesn't | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# declearing global variable with $ before variable | |
$global_var = 2 | |
# declearing constants with Upper case Letters | |
CONST = 4 | |
# declearing Integer | |
x = 1 | |
# declearing Floating point integer | |
y = 1.2 | |
# declearing String | |
z = "this is a string" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Defining a Funcion Normally | |
def foo() | |
1 # if there is no semicolon at the last line then the last line is return as function's return value | |
end # this denotes the function has ended | |
# Defining Function with Arguements | |
def sum(x,y) | |
x+y # x+y is returned | |
end | |
# Defining Function with Arguements without paranthesis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
def cool(): | |
print("Sha Bang Example") | |
cool() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# write the complete path | |
read -p "Search For File: " x; | |
# -a flag to see if file exists | |
if [ -a $x ] ; then | |
echo "File Exists" | |
else | |
echo "File Not Found" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read -p "Type Two numbers with spaces : " x y | |
if [ $x -gt $y ] ; then | |
echo "$x is greater than $y" | |
elif [ $y -gt $x ] ; then | |
echo "$y is greater than $x" | |
elif [ $x -eq $y ] ; then | |
echo "$x is equal to $y" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -n "Enter the name of an animal: " | |
read ANIMAL | |
echo -n "The $ANIMAL has " | |
case $ANIMAL in | |
horse | dog | cat) echo -n "four";; | |
man | kangaroo ) echo -n "two";; | |
*) echo -n "an unknown number of";; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Select any one interface :"; | |
interface="" | |
for iface in $(ifconfig | cut -d ' ' -f1| tr ':' '\n' | awk NF) | |
do | |
interface+="$iface" | |
interface+=" " | |
done | |
# it splits strings using whitespace as delimeter and shows us which one to select using digits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[A] | |
2975c.v.fwmrm.net=127.0.0.1 | |
2mdn.net=127.0.0.1 | |
ad.doubleclick.net=127.0.0.1 | |
ad-g.doubleclick.net=127.0.0.1 | |
ad.mo.doubleclick.net=127.0.0.1 | |
ads.doubleclick.net=127.0.0.1 | |
adservice.google.com=127.0.0.1 | |
ads.youtube.com=127.0.0.1 | |
ad.youtube.com=127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
#![no_main] | |
use panic_halt; | |
use cortex_m::asm::delay; | |
use cortex_m_rt::entry; // The runtime | |
use embedded_hal::digital::v2::OutputPin; // the `set_high/low`function | |
use stm32f1xx_hal::{delay::Delay, pac, prelude::*}; // STM32F1 specific functions | |
use stm32f1xx_hal::usb::{Peripheral, UsbBus}; |
OlderNewer