Skip to content

Instantly share code, notes, and snippets.

@kennethnwc
kennethnwc / .bash_profile
Created February 12, 2021 04:48
macos bash setup
HOST_NAME=minima
source ~/.nvm/nvm.sh
nvm use stable
shopt -s autocd
shopt -s histappend
export PATH=$PATH:$HOME/bin
export HISTSIZE=5000
@kennethnwc
kennethnwc / main.py
Created February 9, 2021 07:41
Fastapi Tortoise orm , pydantic relation
from typing import Optional
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
import uvicorn
from tortoise import Tortoise, run_async
from tortoise.contrib.fastapi import register_tortoise
from tortoise.query_utils import Q
import pandas as pd
from models import Address_Pydantic, Address, Category_Pydantic, Category
@kennethnwc
kennethnwc / .dockerignore
Last active July 28, 2024 08:09
My docker-compose with nextjs and nginx
.next/
node_modules/
Dockerfile
yarn-error.log
.dockerignore
.git
.gitignore
@kennethnwc
kennethnwc / index.tsx
Created June 12, 2020 04:22
with d.ts
import Link from "next/link";
import Layout from "../components/Layout";
import { btn, btnPrimary } from "./_app.module.scss";
const IndexPage = () => (
<Layout title="Home | Next.js + TypeScript Example">
<h1>Hello Next.js 👋</h1>
<p>
<Link href="/about">
<a>About</a>
@kennethnwc
kennethnwc / package.json
Created June 12, 2020 04:16
next-bootstrap-scss-typescript
{
"name": "with-typescript",
"version": "1.0.0",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"type-check": "tsc",
"scss": "tsm pages --aliasPrefixes.~ node_modules/"
},
import Link from "next/link";
import Layout from "../components/Layout";
import styles from "./_app.module.scss";
const IndexPage = () => (
<Layout title="Home | Next.js + TypeScript Example">
<h1>Hello Next.js 👋</h1>
<p>
<Link href="/about">
<a>About</a>
@import "~bootstrap/scss/_functions";
@import "~bootstrap/scss/_variables";
@import "~bootstrap/scss/_mixins";
@import "~bootstrap/scss/_root";
@import "~bootstrap/scss/_reboot";
@import "~bootstrap/scss/_type";
@import "~bootstrap/scss/_images";
@import "~bootstrap/scss/_code";
@import "~bootstrap/scss/_grid";
@kennethnwc
kennethnwc / _app.tsx
Created June 12, 2020 04:00
_app.tsx
import { AppProps } from "next/app";
import "./_app.module.scss";
export default ({ Component, pageProps }: AppProps) => {
return <Component {...pageProps} />;
};
const withSass = require('@zeit/next-sass')
module.exports = withSass({
cssModules: true,
cssLoaderOptions: {
camelCase: 'dashes',
importLoaders: 1,
localIdentName: "[local]___[hash:base64:5]",
},
sassLoaderOptions: {
includePaths: ["node_modules", "./node_modules"],