Skip to content

Instantly share code, notes, and snippets.

View Nydhal's full-sized avatar
🎯
Focusing

Nidhal Selmi Nydhal

🎯
Focusing
View GitHub Profile
<?xml version="1.0" encoding="UTF-8" ?>
<Hotels>
<Hotel Stars="****">
<Name>Harbor View Inn</Name>
<Contact>
<Phone>(805)963-0780</Phone>
<Email>contact@harborviewinn.com</Email>
</Contact>
<Address BusLines="R2">
<Number>28</Number>
@Nydhal
Nydhal / auto_sparky.py
Created November 21, 2017 17:59
code snippet for /r/place to draw ASU sparky
import math
import sys
import time
import random
import requests
from PIL import Image
from requests.adapters import HTTPAdapter
img = Image.open(sys.argv[1])
@Nydhal
Nydhal / perceptron_test.py
Created November 13, 2017 00:46
Simple perceptron neural net to test boolean functions (CSE471).
import math
def sig(x):
return 1 / (1 + math.exp(-x))
b = [0,1]
# INPUT WEIGHTS #
w1 = [ 2, 1,-3,-4,-4, 4]
@Nydhal
Nydhal / quick_sort.py
Last active November 21, 2017 17:59
CLRS introduction to algorithms Quicksort with decision tree outputs
## Quicksort
def swap(array,i,j):
temp = array[i]
array[i] = array[j]
array[j] = temp
def partition(array, start,end):
print('->P(',start,end,')')
x = array[end]
@Nydhal
Nydhal / queue.cpp
Last active November 12, 2021 04:47
Queue Class example with explanations in C++
#include <iostream>
using namespace std;
class Queue { // Class definition
private: //private members can only be accessed in the class
int queue_size;
protected: // protected members can ba accessed in derived classes
int* buffer; // pointer to first element of array
int front; // used for removing an element of array
int rear; // user for adding an element into queue
@Nydhal
Nydhal / bubble.c
Last active November 21, 2017 18:00
bubble sort in C
void sortStrings(char strings[NUM_STRINGS][STRING_LENGTH]){
for (int i = 0; i < NUM_STRINGS-1 ; i++){
for (int j = 0; j < NUM_STRINGS-i-1; j++){
if (strcmp(strings[j],strings[j+1])>0) {swapStrings(strings[j], strings[j + 1]);
}}}}
Verifying that +nidhalselmi is my blockchain ID. https://onename.com/nidhalselmi