Skip to content

Instantly share code, notes, and snippets.

View Rahmanism's full-sized avatar
💻
I'm coding!

Rahmani Rahmanism

💻
I'm coding!
View GitHub Profile
@Rahmanism
Rahmanism / file-listing-web.py
Last active April 17, 2023 05:27
File listing using Python for web
# -*- coding: utf-8 -*-
import os, sys
print('Content-Type: text/html; charset=utf-8')
print('')
print('<!DOCTYPE html>')
print('<html>')
print('<head>')
print('<meta charset="utf-8" />')
print('<meta name="viewport" content="width=device-width, initial-scale=1.0">')
@Rahmanism
Rahmanism / encoding.py
Created April 16, 2023 09:24
Find the encoding of a file
import sys, chardet
with open(sys.argv[1], 'rb') as f:
result = chardet.detect(f.read())
print(result['encoding'])
@Rahmanism
Rahmanism / dockerfile-apache-centos7
Created August 15, 2024 11:32
Dockerfile for Apache on CentOS 7
FROM centos:7
LABEL Remarks="This is a dockerfile example for Centos system"
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
RUN yum -y update && yum -y install httpd && yum clean all
# ADD ./site/html.tar.gz /var/www/html/
EXPOSE 80
CMD ["apachectl", "-D", "FOREGROUND"]
@Rahmanism
Rahmanism / mytube-embed.html
Last active January 16, 2025 08:10
Load a YouTube video in embed mode.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>MyTube</title>
<style>