Skip to content

Instantly share code, notes, and snippets.

View 7s9n's full-sized avatar
🎓
Learning

Hussein Sarea 7s9n

🎓
Learning
View GitHub Profile
@davidoster
davidoster / dummy-web-server.py
Last active October 1, 2023 01:29 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request:
@cunla
cunla / RequestParser.py
Created June 18, 2020 22:28
Parse http raw request to python http request
import requests
CRLF = '\r\n'
DEFAULT_HTTP_VERSION = 'HTTP/1.1'
class RequestParser(object):
def __parse_request_line(self, request_line):
request_parts = request_line.split(' ')
  • repo -> repository

  • clone -> bring a repo down from the internet (remote repository like Github) to your local machine

  • add -> track your files and changes with Git

  • commit -> save your changes into Git

  • push -> push your changes to your remote repo on Github (or another website)

  • pull -> pull changes down from the remote repo to your local machine

  • status -> check to see which files are being tracked or need to be commited

  • init -> use this command inside of your project to turn it into a Git repository and start using Git with that codebase

@ekbelova
ekbelova / oracle.sql
Last active October 1, 2023 22:18
usefull Oracle queries
SELECT * FROM V$VERSION; --get current Oracle instance version
--for Oracle 10g
--get total size in MB for current user
SELECT sum(bytes)/1024/1024 size_in_mb FROM DBA_SEGMENTS
WHERE OWNER='<user_name>';
--DBA_SEGMENTS describes the storage allocated for all segments in the database.
--related view: USER_SEGMENTS describes the storage allocated for the segments
--owned by the current user's objects.
--This view does not display the OWNER, HEADER_FILE, HEADER_BLOCK, or RELATIVE_FNO columns.
import java.util.ArrayList;
import java.util.List;
public class Solution {
//普通两个数组的点乘
public int dotProduct(int[] a, int[] b) {
int len = a.length;
int res = 0;
for (int i = 0; i < len; i++) {
@hovren
hovren / CMakeLists.txt
Created December 12, 2017 15:35
pybind11 with CMake and setup.py
# Build a Python extension module using pybind11
# pybindings_add_module(<module>)
# Here <module> should be the fully qualified name for the module,
# e.g. pybindings_add_module(foo.bar._baz)
# <module> becomes the target name in case you wish to do something to it later
# The source for the binding *must* be placed in src/pybindings/{relpath}/py{name}.cc
# E.g. for module=foo.bar._baz -> src/pybindings/bar/py_baz.cc
function(pybindings_add_module module)
set(target_name ${module})
string(REPLACE "." "/" modpath ${module})
@doncadavona
doncadavona / Aes256CbcEncrypterApp.cs
Last active June 9, 2024 00:35
A sample C# class to encrypt and decrypt strings using the cipher AES-256-CBC used in Laravel.
using System;
using System.Text;
using System.Security.Cryptography;
using System.Web.Script.Serialization;
using System.Collections.Generic;
namespace Aes256CbcEncrypterApp {
class MainClass {
public static void Main(string[] args) {
Console.WriteLine("Hello, world!");
"""
Implements a simple HTTP/1.0 Server
"""
import socket
def handle_request(request):
"""Handles the HTTP request."""
@joncardasis
joncardasis / WebServer.py
Created February 7, 2017 21:08
A simple and quick HTTP web server in Python
"""
Author: Jonathan Cardasis
"""
import socket
import signal # Allow socket destruction on Ctrl+C
import sys
import time
import threading
@pranavq212
pranavq212 / EMailHelper.cs
Last active December 23, 2023 00:52
Send mail via SMTP c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Mail;
using DomainClasses;
using System.IO;