This file contains hidden or 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
| export const countries = [ | |
| { code: "AF", code3: "AFG", name: "Afghanistan", number: "004" }, | |
| { code: "AL", code3: "ALB", name: "Albania", number: "008" }, | |
| { code: "DZ", code3: "DZA", name: "Algeria", number: "012" }, | |
| { code: "AS", code3: "ASM", name: "American Samoa", number: "016" }, | |
| { code: "AD", code3: "AND", name: "Andorra", number: "020" }, | |
| { code: "AO", code3: "AGO", name: "Angola", number: "024" }, | |
| { code: "AI", code3: "AIA", name: "Anguilla", number: "660" }, | |
| { code: "AQ", code3: "ATA", name: "Antarctica", number: "010" }, | |
| { code: "AG", code3: "ATG", name: "Antigua and Barbuda", number: "028" }, |
This file contains hidden or 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 { z } from "zod"; | |
| export async function fetcher<S extends z.ZodTypeAny>( | |
| url: string, | |
| schema: S, | |
| options?: RequestInit, | |
| ): Promise<z.output<S>> { | |
| const res = await fetch(url, { | |
| headers: { | |
| "Content-Type": "application/json", |
This file contains hidden or 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
| #!/bin/bash | |
| arc=$(uname -a) | |
| pcpu=$(grep "physical id" /proc/cpuinfo | sort | uniq | wc -l) | |
| vcpu=$(grep "^processor" /proc/cpuinfo | wc -l) | |
| fram=$(free -m | awk '$1 == "Mem:" {print $2}') | |
| uram=$(free -m | awk '$1 == "Mem:" {print $3}') | |
| pram=$(free | awk '$1 == "Mem:" {printf("%.2f"), $3/$2*100}') | |
| fdisk=$(df -Bg | grep '^/dev/' | grep -v '/boot$' | awk '{ft += $2} END {print ft}') | |
| udisk=$(df -Bm | grep '^/dev/' | grep -v '/boot$' | awk '{ut += $3} END {print ut}') | |
| pdisk=$(df -Bm | grep '^/dev/' | grep -v '/boot$' | awk '{ut += $3} {ft+= $2} END {printf("%d"), ut/ft*100}') |
This file contains hidden or 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
| #!/bin/bash | |
| wall $'#Architecture: ' `hostnamectl | grep "Operating System" | cut -d ' ' -f5- ` `awk -F':' '/^model name/ {print $2}' /proc/cpuinfo | uniq | sed -e 's/^[ \t]*//'` `arch` \ | |
| '\n#CPU physical: '`cat /proc/cpuinfo | grep processor | wc -l` \ | |
| '\n#vCPU: '`cat /proc/cpuinfo | grep processor | wc -l` \ | |
| '\n'`free -m | awk 'NR==2{printf "#Memory Usage: %s/%sMB (%.2f%%)", $3,$2,$3*100/$2 }'` \ | |
| '\n'`df -h | awk '$NF=="/"{printf "#Disk Usage: %d/%dGB (%s)", $3,$2,$5}'` \ | |
| '\n'`top -bn1 | grep load | awk '{printf "#CPU Load: %.2f\n", $(NF-2)}'` \ | |
| '\n#Last boot: ' `who -b | awk '{print $3" "$4" "$5}'` \ | |
| '\n#LVM use: ' `lsblk |grep lvm | awk '{if ($1) {print "yes";exit;} else {print "no"} }'` \ | |
| '\n#Connection TCP:' `netstat -an | grep ESTABLISHED | wc -l` \ |
This file contains hidden or 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 { Dispatch, SetStateAction, useContext } from 'react' | |
| import { ThemeContext } from '../context/Theme' | |
| import { | |
| DARK_THEME_BACKGROUND, | |
| DARK_THEME_SECONDARY, | |
| DARK_THEME_SECONDARY_VARIANT, | |
| DARK_THEME_TEXT, | |
| DARK_THEME_VARIANT, | |
| DARK_THEME_BACKGROUND_VARIANT, |
This file contains hidden or 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 React, { Dispatch, SetStateAction, useEffect, useState } from 'react' | |
| import { useColorScheme } from 'react-native' | |
| import { getItem, setItem } from '../lib/storage' | |
| export type ThemeOptions = 'light' | 'dark' | |
| export interface ThemeContextInterface { | |
| theme: ThemeOptions | |
| setTheme: Dispatch<SetStateAction<ThemeOptions>> | |
| } |
This file contains hidden or 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 AsyncStorage from '@react-native-async-storage/async-storage' | |
| import { Platform } from 'react-native' | |
| const os = Platform.OS | |
| const webStorage = window.localStorage | |
| const appStorage = AsyncStorage | |
| const getItem = async (key: string) => { | |
| if (key) { | |
| return os === 'web' |
This file contains hidden or 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
| const BRAND_COLOR = '#57C69E' as const | |
| const LIGHT_THEME_BACKGROUND = '#EEEEEE' as const | |
| const LIGHT_THEME_TEXT = '#111111' as const | |
| const LIGHT_THEME_VARIANT = '#333333' as const | |
| const LIGHT_THEME_SECONDARY = '#777777' as const | |
| const LIGHT_THEME_SECONDARY_VARIANT = '#BBBBBB' as const | |
| const LIGHT_THEME_BACKGROUND_VARIANT = '#CCCCCC' as const | |
| const DARK_THEME_BACKGROUND = '#111111' as const |
This file contains hidden or 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
| create type public.user_status as enum ('ONLINE', 'OFFLINE'); | |
| create type public.message_type as enum ('TEXT', 'IMAGE', 'VIDEO'); | |
| create table channels ( | |
| id uuid default uuid_generate_v4() primary key | |
| ); | |
| create table messages ( | |
| id uuid default uuid_generate_v4() primary key, | |
| content text not null, |
This file contains hidden or 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 { useRouter } from 'next/router' | |
| import React, { useEffect } from 'react' | |
| import ReactMarkdown from 'react-markdown' | |
| import PostNotFound from '../../components/errors/PostNotFound' | |
| import DefaultWrapper from '../../components/layout/DefaultWrapper' | |
| import Navigation from '../../components/modules/Navigation' | |
| import { | |
| useFindOneBySlugQuery, | |
| useIncrementViewMutation, | |
| } from '../../generated/graphql' |
NewerOlder