Skip to content

Instantly share code, notes, and snippets.

View Felhamed's full-sized avatar

Firas El-Hamed Felhamed

View GitHub Profile
@Felhamed
Felhamed / index.html
Created January 28, 2018 19:37
bootstrap quick start
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
@Felhamed
Felhamed / index.html
Created November 22, 2017 09:13
Materializecsstemplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" media="screen,projection" />
<!--Let browser know website is optimized for mobile-->
#!/usr/bin/env python
#---------------------------------------------------------------------------#
# import needed libraries
#---------------------------------------------------------------------------#
from twisted.internet import reactor, protocol
from pymodbus.constants import Defaults
#---------------------------------------------------------------------------#
# choose the requested modbus protocol
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# read_register
# read 10 registers and print result on stdout
# you can use the tiny modbus server "mbserverd" to test this code
# mbserverd is here: https://github.com/sourceperl/mbserverd
# the command line modbus client mbtget can also be useful
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# modbus_thread
# start a thread for polling a set of registers, display result on console
# exit with ctrl+c
import time
from threading import Thread, Lock
from pyModbusTCP.client import ModbusClient
@Felhamed
Felhamed / mpvplaylist.py
Last active August 28, 2017 08:09
Generate mpv playlist from url directory
#!/usr/bin/python
import sys
import requests
import subprocess
from bs4 import BeautifulSoup
url = sys.argv[1]
response = requests.get(url)
soup = BeautifulSoup(response.content, "html.parser")
@Felhamed
Felhamed / maxalive.py
Created August 1, 2017 21:56
Python algorithm to find year with max people alive
from collections import Counter, namedtuple
from itertools import chain
from bisect import insort
import numpy as np
import timeit
# Generate random dataset of Birth,Death years
def person_data():
datab=np.random.randint(1800, 2017,size=(100,1))
0xf92669c163E1e08358532C8DFDA479b725cC10d4
@Felhamed
Felhamed / mpv.conf
Last active December 1, 2022 05:29
mpv.conf
# vim: syntax=config
###########
# General #
###########
#save-position-on-quit
no-border # no window title bar
msg-module # prepend module name to log messages