Skip to content

Instantly share code, notes, and snippets.

View EteimZ's full-sized avatar

Youdiowei Eteimorde EteimZ

View GitHub Profile
@EteimZ
EteimZ / Makefile
Last active August 29, 2022 11:01
Demonstrating how to use gnu make.
CC=gcc # compiler
all: mainapp
mainapp: main ops
$(CC) main.o ops.o -o prog
main:
$(CC) -c main.c
@EteimZ
EteimZ / client.py
Last active September 6, 2022 18:47
Simple echo server with client.
import socket
HOST = '127.0.0.1'
PORT = 9000
inp = input('>> ')
bytes_data = bytes(inp, 'utf-8')
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.connect((HOST, PORT))
@EteimZ
EteimZ / inquiry.c
Created September 9, 2022 01:17
Account balancing programs to demonstrate how to work with files in C.
// Balance inquiry
// Resource: C How to Program by The Dietels
#include <stdio.h>
int main( void ){
int request; // request number
int account; // account number
char name[30]; // account name
double balance; // account balance
@EteimZ
EteimZ / client.h
Created September 9, 2022 23:19
Example of working with binary files in C.
struct clientData {
int acctNum; // account number
char lastName[ 15 ]; // account last name
char firstName[ 10 ]; // account first name
double balance; // account balance
};
@EteimZ
EteimZ / sqrt.go
Last active October 17, 2022 12:44
Go snippets
package main
import (
"fmt"
)
/*
GO program to calculate
the square root of a number
*/
@EteimZ
EteimZ / postgres_setup.md
Created October 20, 2022 22:46
steps to setup postgres
$ sudo -i -u postgres
postgres@username:~$ psql
postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
 \q to quit
@EteimZ
EteimZ / tuples.ipynb
Last active October 21, 2022 16:04
A brief outline on python's tuples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EteimZ
EteimZ / vector_class.ipynb
Created October 23, 2022 10:40
Demonstrating OOP in python by creating a vector class.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EteimZ
EteimZ / animating_sine_wave.ipynb
Created October 25, 2022 15:26
Animating a sine wave with matplotlib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EteimZ
EteimZ / sqlite_intro.py
Last active November 1, 2022 18:00
Introduction to the sqlite db in python
import sqlite3 # import the sqlite3 library
con = sqlite3.connect("main.db") # connect to database
cur = con.cursor() # create a db cursor
cur.execute("CREATE TABLE person(fullname, lastname, gender, age)") # create a table with the cursor
cur.execute("""
INSERT INTO person VALUES
('John', 'Doe', 'MALE', 20 ),