These are behind a CDN, so have at them! Poll, ping, hit them as often as you need to!
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 requests | |
import json | |
import gradio as gr | |
url = "http://localhost:11434/api/generate" | |
headers = { | |
'Content-Type': 'application/json', | |
} |
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
# --since='last month' | |
echo "commit id|author|date|comment|changed files|lines added|lines deleted" > github_log.csv | |
git log --after='2022-1-1' --date=local --all --pretty=format:'@%h|%an|%ad|%s|' --shortstat --no-merges | tr "\n" " " | tr "@" "\n" >> github_log.csv | |
sed -i 's/ files changed,/|/g' github_log.csv | |
sed -i 's/ file changed,/|/g' github_log.csv | |
sed -i 's/ insertions(+),/|/g' github_log.csv | |
sed -i 's/ insertion(+),/|/g' github_log.csv | |
sed -i 's/ insertions(+)/|0/g' github_log.csv | |
sed -i 's/ insertion(+)/|0/g' github_log.csv | |
sed -i 's/ deletions(-)//g' github_log.csv |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[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
my_kmeans <- function(data, k, n_iterations) { | |
# Helper function for euclidean distance | |
euclidean_distance <- function(p1, p2) { | |
dist <- sqrt(sum((p1-p2)^2)) | |
return(dist) | |
} | |
# Initialize centers randomly | |
centers <- df[sample(nrow(df), k, replace = FALSE), ] | |
# Perform n iterations |
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
def strip_dict(d): | |
""" | |
Strip all leading and trailing whitespace in dictionary keys and values. | |
""" | |
return dict((k.strip(), v.strip()) for k, v in d.items()) |
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 | |
from sys import argv | |
from hashlib import sha1 | |
from cStringIO import StringIO | |
class githash(object): | |
def __init__(self): | |
self.buf = StringIO() |
Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"
This is a guide to show you step by step how this can be setup. If you just want to get started, use the cookiecuter I set up cookiecutter-django-reactjs. It basically is a fork of pydanny's cookiecutter, just added the front-end stuff :).
I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)
Main features:
- Django REST APIs
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
/*==RESIZE CANVAS TO MAINTAIN PROPORTION ==*/ | |
var fixDimensions = function(){ | |
//Get the image dimensions: | |
var image = { | |
width: $("canvas").width(), | |
height: $("canvas").height() | |
}; | |
//Get the page dimensions: |
NewerOlder