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 chess | |
import chess.engine | |
from collections import defaultdict | |
from marvin import ai_fn, ai_model | |
from pydantic import BaseModel, Field | |
def describe_board(board, illegal_moves): | |
result = "" | |
me = board.turn |
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
#include <assert.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#define N (100000063/64) | |
struct bitset { | |
uint64_t bits[N]; |
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
const https = require("https"); | |
const token = ""; // change this to you telegram bot token! | |
const chatId = ""; // change this to your telegram chat id! | |
const cookie = ""; // change this to your shanbay cookie! | |
const PATH_API = (page) => | |
`/wordsapp/user_material_books/blozps/learning/words/today_learning_items?ipp=10&page=${page}&type_of=NEW`; | |
const options = { |
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 React, { useState } from 'react' | |
import ReactMapGL, { Marker } from 'react-map-gl' | |
import { WebMercatorViewport } from '@deck.gl/core' | |
const getBoundsForPoints = (points, { width = 200, height = 500, padding = 0 } = {}) => { | |
// Calculate corner values of bounds | |
const pointsLong = points.map(point => point.coordinates._long) | |
const pointsLat = points.map(point => point.coordinates._lat) | |
const cornersLongLat = [ | |
[Math.min(...pointsLong), Math.min(...pointsLat)], |
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
class TrieNode { | |
constructor(char) { | |
this.char = char; | |
this.validWord = false; | |
this.parent = null; | |
this.children = []; | |
} | |
} | |
class Trie { |
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
# aproducer.py | |
# | |
# Async Producer-consumer problem. | |
# Challenge: How to implement the same functionality, but no threads. | |
import time | |
from collections import deque | |
import heapq | |
class Scheduler: |
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
// usage: open chrome console, paste this and enter | |
const WORD_PER_PAGE = 10; | |
const START_PAGE = 1; | |
const END_PAGE = 10; | |
const BOOK_ID = 'tvbmg'; | |
// const WORD_LIST_TYPE = 4; // 今日新词 | |
const WORD_LIST_TYPE = 5; // 今日复习 | |
function playItHere(e, link) { |
ESPN's hidden API endpoints
Latest News: http://site.api.espn.com/apis/site/v2/sports/football/college-football/news
Latest Scores: http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
- There are always 24 hours in a day.
- February is always 28 days long.
- Any 24-hour period will always begin and end in the same day (or week, or month).
NewerOlder