Skip to content

Instantly share code, notes, and snippets.

View YannMjl's full-sized avatar
💭
Learning is experience; everything else is just information!

Yann Mulonda YannMjl

💭
Learning is experience; everything else is just information!
View GitHub Profile
#----------------------------------------------------------------------------------------------------#
# basic IoT-Chat app on Pubnub with latest Python SDK #
# import function from standard librairy section: PubNub #
#----------------------------------------------------------------------------------------------------#
from pubnub.callbacks import SubscribeCallback
from pubnub.enums import PNStatusCategory
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub
from threading import Thread
#----------------------------------------------------------------------------------------------------#
@YannMjl
YannMjl / doorStatus.sh
Created June 8, 2018 21:47
Shell Script for door monitor
# ------------------------------------------------------------------------------------------ #
# This script is used to monitor the status of a door with a Raspberry Pi 3 Mobel B #
# and send an email when the door is opened or closed #
# ------------------------------------------------------------------------------------------ #
#!/bin/bash
echo "4" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio4/direction
# create an infinite loop inside wwhich operations will be done
# to continuously check for door status and send notifications
@YannMjl
YannMjl / ssmtp.config
Created June 8, 2018 22:15
Custom setting of ssmtp for the pi to send emails
# -------------------------------------------------------------------------------------------- #
# Config file for sSMTP sendmail #
# -------------------------------------------------------------------------------------------- #
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
#root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
@YannMjl
YannMjl / HelloWorld.cs
Last active September 10, 2022 00:20
HelloWorld program in C#
using System;
namespace HelloWorld
{
class helloWorld
{
static void Main(string[] args)
{
Console.WriteLine("Hello World, This is my first C# program");
Console.ReadKey();
@YannMjl
YannMjl / Inheritance.cs
Last active June 11, 2018 15:20
Inheritance example c#
using System;
namespace InheritanceExample
{
public class humanBeing
{
public humanBeing()
{
Console.WriteLine("Calling the human being class constructor");
}
@YannMjl
YannMjl / polymorphism.cs
Last active June 9, 2018 19:02
Polymorphism: overloading example
using System;
namespace polymorphismExample
{
public class Numbers
{
public void addition(int a, int b)
{
Console.WriteLine(a + b);
}
@YannMjl
YannMjl / polyOverridding.cs
Last active June 11, 2018 15:23
Polymorphism: Late biding or Overriding example
using System;
namespace polymorphismExample
{
public class parentClass
{
public virtual void Display()
{
Console.WriteLine("Hello! My name is Yann!");
}
@YannMjl
YannMjl / rc.local
Created June 12, 2018 04:36
edited rc.local file that start a shell script when the Pi boots
# ---------------------------------------------------------------------------------- #
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
@YannMjl
YannMjl / scriptStatus.sh
Created June 12, 2018 04:54
Checking script status / detecting script crash
# ------------------------------------------------------------------------------------- #
# This script is used to check the status of the doorStatus script #
# ------------------------------------------------------------------------------------- #
#!/bin/bash
while true;
do
# start doorStatus script and output error to a text file
# the '&'' puts the process into the background, so the script goes to the next line
bash /home/pi/Desktop/MyScripts/doorStatus.sh &
# -------------------------------------------------------------------------------------------------------------------------- #
# This script below will email a time & date stamped photo #
# -------------------------------------------------------------------------------------------------------------------------- #
#!/bin/bash
# create an infinite loop inside wwhich operations will be done
# to continuously check for door status and send notifications
while true;
do