Skip to content

Instantly share code, notes, and snippets.

View DanielChuDC's full-sized avatar
🎯
Focusing

danielchu DanielChuDC

🎯
Focusing
  • singapore
View GitHub Profile
@DanielChuDC
DanielChuDC / main.c
Created February 5, 2022 18:32 — forked from johnkawakami/main.c
Two examples of how to use GArray
#include <glib.h>
#include <stdio.h>
int main( int argc, char *argv[] )
{
GString *s;
GString gs;
GArray *a;
int i;
@DanielChuDC
DanielChuDC / zram.sh
Last active January 31, 2022 18:30
zram.sh (modified version * 2 )
#!/bin/bash
export LANG=C
cores=$(nproc --all)
# disable zram
core=0
while [ $core -lt $cores ]; do
if [[ -b /dev/zram$core ]]; then
#!/bin/bash
# lsb_release -a
# Distributor ID: Ubuntu
# Description: Ubuntu 20.04.3 LTS
# Release: 20.04
# Codename: focal
VERSION=2021.2
VIVADO_WORKSPACE=$HOME/vivado
from fastapi import FastAPI
from fastapi import HTTPException, Security
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from auth import Auth
from models.user import AuthModel_User
app = FastAPI()
security = HTTPBearer()
auth_handler = Auth()
import jwt
from fastapi import HTTPException
from passlib.context import CryptContext
from datetime import datetime, timedelta
from config import settings
import base64
import json
from jwt.algorithms import ECAlgorithm
@DanielChuDC
DanielChuDC / Install opencv-python 4.5.3.56 on raspberry pi model 4
Created August 27, 2021 16:58
Install opencv-python 4.5.3.56 on raspberry pi model 4
## Tested on
# pi@raspberrypi:~ $ python3 --version
# Python 3.7.3
# pi@raspberrypi:~ $ pip3 --version
# pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
curl https://pyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
@DanielChuDC
DanielChuDC / install_python38_on_py.sh
Last active August 27, 2021 14:25 — forked from stephen-mw/install_python38_on_pi.sh
Install python3.8 and make the system default on Raspberry Pi
#!/usr/bin/env bash
set -euo pipefail
# This script downloads, compiles, and installs python3.8 as the system default
export VERSION=3.8.5
apt install -y \
build-essential \
libbz2-dev \
import 'package:flutter/material.dart';
@immutable
class ClipShadowPath extends StatelessWidget {
final Shadow shadow;
final CustomClipper<Path> clipper;
final Widget child;
ClipShadowPath({
@required this.shadow,
@DanielChuDC
DanielChuDC / poc.html
Created January 20, 2021 05:03 — forked from kenrick95/poc.html
Handles Play/Pause Media Key
<!DOCTYPE html>
<html lang="en" style="width: 100%; height: 100%;">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PoC</title>
</head>
<body style="width: 100%; height: 100%;">
<audio
id="player"
@DanielChuDC
DanielChuDC / poc.html
Created January 20, 2021 05:03 — forked from kenrick95/poc.html
Handles Play/Pause Media Key
<!DOCTYPE html>
<html lang="en" style="width: 100%; height: 100%;">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>PoC</title>
</head>
<body style="width: 100%; height: 100%;">
<audio
id="player"