function getTextWidth(text, font) {
var canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement("canvas"));
var context = canvas.getContext("2d");
context.font = font;
var metrics = context.measureText(text);
return metrics.width;
}
var text = $('input').val();
if (!text) text = $('input').attr('placeholder');
var width_text = getTextWidth(text, $('body').css('font'));
alert(width_text);
lsof -i:27017
sudo apt-get install mongodb
sudo service mongodb start
tail -n200 /var/log/mongodb/mongodb.log
brew update
brew install mongodb
mkdir -p /data/db
sudo chmod -R 777 /data/db
mongod
import requests, vk_api
vk = vk_api.VkApi(token='blablabla')
vk.auth()
a = vk.method('photos.getMessagesUploadServer')
b = requests.post(a['upload_url'], files={'photo': open('blabla', 'rb')}).json()
c = vk.method('photos.saveMessagesPhoto', {'photo': b['photo'], 'server': b['server'], 'hash': b['hash']})[0]
d = 'photo{}_{}'.format(c['owner_id'], c['id'])
vk.method('messages.send', {'user_id': 'bla', 'attachment': d})
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11);
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
mySerial.println("AT+RST");
mySerial.println("AT+GMR");
mySerial.println("AT+CWMODE_DEF=1");//_DEF
delay(50);
mySerial.println("AT+CWJAP_DEF=\"routerr\",\"1029384756\"");
delay(6000);
mySerial.println("AT+CIPSTART=\"TCP\",\"192.168.1.11\",80");
delay(50);
mySerial.println("AT+CIPSEND=43");
delay(50);
mySerial.println("GET / HTTP/1.1\r\nHost: 192.168.1.11\r\n\r\n\r\n\r\n");
//delay(5000);
//mySerial.println("AT+CIPCLOSE");
}
void loop()
{
if (Serial.available()) mySerial.write(Serial.read());
if (mySerial.available()) Serial.write(mySerial.read());
delay(10);
}