This file contains hidden or 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 math import floor, ceil | |
from typing import AnyStr | |
ASCII_TO_INT: dict = {i.to_bytes(1, 'big'): i for i in range(256)} | |
INT_TO_ASCII: dict = {i: b for b, i in ASCII_TO_INT.items()} | |
def compress(data: AnyStr) -> bytes: | |
if isinstance(data, str): |
This file contains hidden or 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
# Heavily inspired by https://github.com/jimhester/jimhester.com/blob/433629b9ecfdc8861022492ae77438cabb5273f3/content/home/graph.R | |
library(tidyverse) | |
library(rvest) | |
library(echarts4r) | |
library(lubridate) | |
github_data <- function(from = to - years(1), to = today(), user = "mcnakhaee") { | |
html <- xml2::read_html(str_glue("https://github.com/users/{user}/contributions?from={from}&to={to}&tab=overview")) | |
calendar <- html_node(html, ".js-calendar-graph-svg") | |
calendar_days <- html_nodes(calendar, "rect") |
This file contains hidden or 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
plot_interactive_graph <- function(data){ | |
graph_edges_tbl <- data %>% | |
rename(from = source, to = target) | |
ggraph_df <- graph_edges_tbl %>% | |
as_tbl_graph(directed = FALSE) %>% | |
activate(nodes) %>% | |
mutate( | |
centrality_degree = centrality_degree(), |
This file contains hidden or 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
data %>% | |
count(from = item1,to = item2) %>% | |
select(from,to,n) %>% | |
as_tbl_graph(directed = FALSE) %>% | |
ggraph(layout = "kk") + | |
geom_edge_link(aes(edge_width = n,alpha = n,colour = n)) + | |
geom_node_label(aes(label = name),size = 4,repel = TRUE,family = 'Rubik') + | |
geom_node_point(size = 5) | |
This file contains hidden or 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
""" | |
We implement additional hyperparameter optimization methods not present in | |
https://scikit-optimize.github.io/. | |
Gist: https://gist.github.com/Deepblue129/2c5fae9daf0529ed589018c6353c9f7b | |
""" | |
import math | |
import logging | |
import random |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Python Basics with Numpy (optional assignment)\n", | |
"\n", | |
"Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help familiarize you with functions we'll need. \n", | |
"\n", |
This file contains hidden or 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
plt.xlabel("یک محور همینجوری",fontsize = 15) | |
plt.ylabel("یک محور دیگه همینجوری",fontsize = 15) | |
plt.title("یک نمودار همینجوری" , fontsize = 20) | |
plt.show() |