Skip to content

Instantly share code, notes, and snippets.

View PYTHON01100100's full-sized avatar

ABDULRAHMAN AL-MYMAN_عبدالرحمن الميمان PYTHON01100100

View GitHub Profile
@yaashwardhan
yaashwardhan / main.dart
Last active February 18, 2021 16:39
Passing values from Stateless Widgets to other Stateless Widgets and Making New widgets to write cleaner code and remove repetitive code
//Passing values from Stateless Widgets to other Stateless Widgets and Making New widgets to write cleaner code and remove repetitive code
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
@essenwbb
essenwbb / socket-1-5.md
Last active August 3, 2020 17:27
socket

socket

Socket API 概览

Socket API 函数和方法有下面这些:

  • socket()

  • bind()

  • listen()

@srahuliitb
srahuliitb / rock_paper_scissor.py
Last active February 9, 2023 14:06
Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, and ask if the players want to start a new game)
p1_call = raw_input("Player 1, Enter rock/paper/scissors: ")
p2_call = raw_input("Player 2, Enter rock/paper/scissors: ")
def rock_paper_scissors(player_1, player_2):
a_list = ["rock", "paper", "scissors"]
while player_1 not in a_list or player_2 not in a_list:
print "Invalid input. Please give a valid input."
player_1 = raw_input("Player 1, Enter rock/paper/scissors: ")
player_2 = raw_input("Player 2, Enter rock/paper/scissors: ")
@tuxfight3r
tuxfight3r / bind_socket.py
Last active April 24, 2023 14:27
python tcp socket client / server examples
#!/usr/bin/python
import socket #for sockets
import sys #for exit
try:
#create an AF_INET, STREAM socket (TCP)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error, msg:
print 'Failed to create socket. Error code: ' + str(msg[0]) + ' , Error message : ' + msg[1]
@aprchen
aprchen / wxrobot.py
Last active August 3, 2020 09:20
微信机器人 脚本 添加 监听端口线程
#!/usr/bin/env python3
# coding: utf-8
#1安装python3
#2命令行 执行 pip3 install -i https://pypi.doubanio.com/simple/ -U wxpy
#3在终端中显示登陆二维码,需要安装 pillow 模块 (pip3 install pillow)。
import datetime
import logging
@renorzr
renorzr / mac_address.py
Last active August 3, 2020 17:27
get mac address
# -*- coding: utf-8 -*-
import locale
import random
import _winreg
import subprocess
import socket
import time
SUBKEY = r'SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0001'
@zhenyi2697
zhenyi2697 / get_mac_address.py
Created July 25, 2013 14:45
Python: get mac address of a interface
import socket
import fcntl
import struct
def getHwAddr(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15]))
return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1]
@xavierskip
xavierskip / MACIP.py
Created July 6, 2013 06:12
Get MAC and IP address
import ctypes
import socket
import struct
def get_macaddress(host):
""" Returns the MAC address of a network host, requires >= WIN2K.
"""
# Check for api availability
try:
@sposterkil
sposterkil / mvhp.py
Created May 17, 2013 01:32
mvhp-joe
#!/bin/env python
# -*- coding: utf-8 -*-
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
import asyncore
@SuperRoach
SuperRoach / KickClass.py
Created April 23, 2013 10:26
This is a class that eventually talks to a light :) Looking in KickClass.py The code is fairly commented to the problems I'm running into, but... Line 71: I'm trying to set the length as "2 byte, high byte and low byte". Would the hardcoded example be correct for 3? Line 77: How can I correctly get the length of self.Data ? If I put two hex char…
# The Kick light - Python interface to control it via the Wireless api.
#
# Before using this class, it's currently required for you to connect
# your kick to the device running this, using AD-HOC. If the connection drops,
# you have Wi-Fi drivers that do not support AD-HOC mode.
#
# Changing colour will have no effect unless the light is visible.
import binascii
import socket