import socket
s = socket.socket()
host = socket.gethostname() port = 9009 s.bind((host,port)) print('This host/server ID is: ', host) print('\n',host,'has been binded to',port) print('\nServer is listening for incoming connections')
import socket
s = socket.socket()
host = socket.gethostname() port = 9009 s.bind((host,port)) print('This host/server ID is: ', host) print('\n',host,'has been binded to',port) print('\nServer is listening for incoming connections')
| 111now its public |
| import cv2 | |
| import numpy as np | |
| import time | |
| def filter_image(img, hsv_lower, hsv_upper): | |
| img_filt = cv2.medianBlur(img, 11) | |
| hsv = cv2.cvtColor(img_filt, cv2.COLOR_BGR2HSV) | |
| mask = cv2.inRange(hsv, hsv_lower, hsv_upper) | |
| return mask |
| #!/usr/bin/env python3 | |
| #!c:/Python35/python3.exe -u | |
| import asyncio | |
| import sys | |
| import cv2 | |
| import numpy as np | |
| import cozmo | |
| import time | |
| import os | |
| from glob import glob |
| require 'cinch' | |
| require 'open-uri' | |
| require 'json' | |
| require 'date' | |
| class Rando | |
| include Cinch::Plugin | |
| match /raw (.+)/, method: :do_raw | |
| match /refresh/, method: :do_refresh | |
| match /index/, method: :do_index_get | |
| match /index (.+)/, method: :do_index_set |
| #!/usr/bin/env ruby | |
| # encoding: UTF-8 | |
| require 'snoo' | |
| reddit = Snoo::Client.new :useragent => '/u/flotwig - Responds to "It is known." with "It is known." http://l.t.tl/1q' | |
| reddit.log_in 'KhaleesiServantGirl', '' | |
| debug = false | |
| latest_id = 0 | |
| def base10_reddit_id(base36_id) | |
| return base36_id.split('_',2).last.to_i(36) | |
| end |
| # because i keep forgetting | |
| rm znc.pem | |
| openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -nodes | |
| cat key.pem > znc.pem | |
| cat cert.pem >> znc.pem |
| <?php | |
| function pingMCServer($server,$port=25565,$timeout=2){ | |
| $socket=socket_create(AF_INET,SOCK_STREAM,getprotobyname('tcp')); // set up socket holder | |
| socket_connect($socket,$server,$port); // connect to minecraft server on port 25565 | |
| socket_send($socket,chr(254).chr(1),2,null); // send 0xFE 01 -- tells the server we want pinglist info | |
| socket_recv($socket,$buf,3,null); // first 3 bytes indicate the len of the reply. not necessary but i'm not one for hacky socket read loops | |
| $buf=substr($buf,1,2); // always pads it with 0xFF to indicate an EOF message | |
| $len=unpack('n',$buf); // gives us 1/2 the length of the reply | |
| socket_recv($socket,$buf,$len[1]*2,null); // read $len*2 bytes and hang u[ | |
| $data=explode(chr(0).chr(0),$buf); // explode on nul-dubs |
| <?php | |
| // example usage: | |
| // redditApi('user/flotwig'); will return an array with information about me | |
| // redditApi('r/breakingbad'); will return an array of info about r/breakingbad | |
| function redditApi($call,$domain='www.reddit.com') { | |
| $url = 'http://' . $domain . '/' . $call . '.json'; | |
| if (function_exists('curl_init')) { // not all PHP installs have cURL | |
| $ch = curl_init($url); | |
| curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE); | |
| curl_setopt($ch,CURLOPT_USERAGENT,'/u/flotwig'); // for stats |