This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from 'react'; | |
export default function useMousePosition() { | |
const [coords, setCoords] = useState({ x: 0, y: 0 }); | |
useEffect(() => { | |
const handleWindowMouseMove = (event: MouseEvent) => { | |
setCoords({ | |
x: event.clientX, | |
y: event.clientY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socketserver | |
import time | |
cache = {} | |
class MyTCPHandler(socketserver.StreamRequestHandler): | |
def handle(self): | |
while True: | |
if not self.rfile.peek(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
name = None | |
in_text = False | |
current_text = "" | |
all_text = [] | |
for line in open("stats.txt"): | |
#print('current line: %s in_text: %s name: %s' % (line.strip(), in_text, name)) | |
line = line.strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
console.log('Loading function'); | |
const doc = require('dynamodb-doc'); | |
const dynamo = new doc.DynamoDB(); | |
exports.handler = (event, context, callback) => { | |
//console.log('Received event:', JSON.stringify(event, null, 2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = open("/Users/Ron/words.txt").read().decode("utf8").split() | |
first_row = ["ק", "ר", "א", "ט", "ו", "ן", "ם", "פ"] | |
second_row = ["ש", "ד", "ג", "כ", "ע", "י", "ח", "ל", "ך", "ף"] | |
third_row = ["ז", "ס", "ב", "ה", "נ", "מ", "צ", "ת", "ץ"] | |
first_row = [x.decode("utf8") for x in first_row] | |
second_row = [x.decode("utf8") for x in second_row] | |
third_row = [x.decode("utf8") for x in third_row] | |
only_first = sorted([(len(x), x) for x in a if all(y in first_row for y in x)]) | |
only_second = sorted([(len(x), x) for x in a if all(y in second_row for y in x)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# python 3.5 async web crawler. | |
# https://github.com/mehmetkose/python3.5-async-crawler | |
# Licensed under the MIT license: | |
# http://www.opensource.org/licenses/mit-license | |
# Copyright (c) 2016 Mehmet Kose [email protected] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import Column, Integer, String, ForeignKey, create_engine | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import relationship, backref, sessionmaker, joinedload | |
# For this example we will use an in-memory sqlite DB. | |
# Let's also configure it to echo everything it does to the screen. | |
engine = create_engine('sqlite:///:memory:', echo=True) | |
# The base class which our objects will be defined on. | |
Base = declarative_base() |