Skip to content

Instantly share code, notes, and snippets.

from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
import matplotlib.pyplot as plt
import numpy as np
digits = datasets.load_digits()
X = digits["data"]
Y = digits["target"]
@JediKnightChan
JediKnightChan / index.html
Created September 8, 2018 23:37
Video.js Default Skin
<!--
Don't use the "5-unsafe" CDN version in your own code. It will break on you.
Instead go to videojs.com and copy the CDN urls for the latest version.
-->
<div id="instructions">
<video id="my_video_1" class="video-js vjs-default-skin" width="640px" height="267px"
controls preload="none" poster='http://video-js.zencoder.com/oceans-clip.jpg'
data-setup='{ "aspectRatio":"640:267", "playbackRates": [1, 1.5, 2] }'>
package main
import (
"errors"
"fmt"
"math"
)
type Vector struct {
Body []float64
@JediKnightChan
JediKnightChan / playerjs_base64.py
Last active December 16, 2018 11:04
Functions for video link protection in PlayerJS (Python)
from base64 import b64encode, b64decode
import random
pjs_b64_separator = b"//"
pjs_b64_keys = ["", "", "", "", ""]
def pjs_b64_encrypt(string):
"""
Encrypts given string using base64 and pjs_b64_keys,
returns the encrypted string
import os
import re
import requests
import urllib.parse
from bs4 import BeautifulSoup
common = "https://www.example.com/"
start_url = "https://www.example.com/index.html"
import pandas as pd
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import os
from sklearn.model_selection import train_test_split
import pyhmmer
def generate_dataset():
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
_____ _____ _____ _____ _____ _____ _____ _____
/\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \ /\ \
/::\ \ /::\____\ /::\ \ /::\ \ /::\ \ /::\ \ /::\ \ /::\ \
\:::\ \ /:::/ / /::::\ \ /::::\ \ /::::\ \ \:::\ \ \:::\ \ /::::\ \
\:::\ \ /:::/ / /::::::\ \ /::::::\ \ /::::::\ \ \:::\ \ \:::\ \ /::::::\ \
import json
import re
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
# CHANGEME
json_filepath = "./output/NC_015434.json"
with open(json_filepath, "r") as f:
@JediKnightChan
JediKnightChan / web_parser.py
Created May 24, 2022 13:58
A simple website (HTML, CSS, JS) parser
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin, urlsplit
import os
save = True
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1)'}
base_dir = "./parse-results/"