Skip to content

Instantly share code, notes, and snippets.

@johnny12150
johnny12150 / pyg-hetero.ipynb
Created April 26, 2022 14:19
PyG Hetero.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnny12150
johnny12150 / App.tsx
Last active March 13, 2022 04:43
react-bootstrap-with-full-calendar-v5
import React, {useRef, useState} from 'react'
import FullCalendar from '@fullcalendar/react' // must go before plugins
import dayGridPlugin from '@fullcalendar/daygrid' // a plugin!
import CSS from 'csstype'
import {Overlay, OverlayTrigger, Popover, Tooltip} from "react-bootstrap";
import {EventSourceInput} from "@fullcalendar/common";
import 'bootstrap/dist/css/bootstrap.min.css';
import ReactDOM from "react-dom";
// height只能在calendar內控制
@johnny12150
johnny12150 / index.html
Last active August 8, 2021 16:11
純JS - 照片上傳、下載與預覽
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
img {
width: 150px;
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => {
res.send('Hello World!')
})
// POST method route
app.post('/', function (req, res) {
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Load CDC API</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<!-- in order to use JSX -->
@johnny12150
johnny12150 / max_seat.html
Last active July 8, 2021 16:36
ty js 101 count selected boxes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Choose your seats</title>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
import numpy as np
import pandas as pd
class SessionPop:
'''
SessionPop(top_n=100, item_key='ItemId', support_by_key=None)
Session popularity predictor that gives higher scores to items with higher number of occurrences in the session. Ties are broken up by adding the popularity score of the item.
The score is given by:

Install docker

 curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh get-docker.sh

Install NV-docker

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && \
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - &amp;&amp; \
import os
import pickle
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from tqdm import tqdm
import copy
def process_seqs(iseqs, idates, ihist=None, data_aug=False, gen_target=True):
'''
產生data