Skip to content

Instantly share code, notes, and snippets.

View majudhu's full-sized avatar
🤔
live curios, why not

Majudhu majudhu

🤔
live curios, why not
View GitHub Profile
@majudhu
majudhu / main.yml
Created November 25, 2020 08:50
Github Action to build Flutter app to Android, Web and Windows
name: Flutter Build Android APK and Windows EXE
on: [workflow_dispatch]
jobs:
apk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
function process(input) { // takes (string) -› returns int
let scan_t = [0, 0]; // scan init
let graph = input
.split('')
.map((c) => {
switch (c) {
case '<': return [-1, 0];
case '^': return [0, 1];
case '>': return [1, 0];
case 'v': return [0, -1];
@majudhu
majudhu / .eslintrc.json
Last active April 16, 2022 09:48
nextjs eslint tailwind next config
{
"env": {
"browser": true,
"node": true,
"es2021": true
},
"extends": ["eslint:recommended", "next"],
"rules": {
"@next/next/no-img-element": "off",
"jsx-a11y/alt-text": "off",
@majudhu
majudhu / demo.js
Last active May 3, 2021 10:34
Type in English to Dhivehi Text Input React https://codesandbox.io/s/dv-text-input-89qp4
import React from "react";
import TextField from "@material-ui/core/TextField";
import DvTextField from "./DvTextField";
export default function Demo() {
return (
<>
<DvTextField
ParentComponent={TextField}
customRef="inputRef"
@majudhu
majudhu / enum_filter.rs
Last active May 14, 2021 14:51
Rust Snippets
#[derive(Debug)]
enum Fruits {
Apple,
Banana,
Orange,
Gauva,
}
#[derive(Debug)]
enum Vegetables {
@majudhu
majudhu / nginx.conf
Last active May 30, 2024 14:35
nginx with nextjs and expressjs api
proxy_cache_path /var/cache/nginx keys_zone=my_cache:20m use_temp_path=off;
proxy_cache my_cache;
proxy_cache_lock on;
proxy_cache_lock_timeout 20s;
map $http_authorization $cachecontrol {
"" "public, max-age=10, s-maxage=5, stale-while-revalidate=20";
}
server {
@majudhu
majudhu / pgp.txt
Last active June 20, 2021 15:01
PGP Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEXw8Q9hYJKwYBBAHaRw8BAQdAPqAvsfCNNRE7crfTijQUWOPA5cDGSP2+xu/h
U+qchZe0LE1hanVkaHUgKG1hanVkaHUuY28pIDxtYWp1ZGh1LnN1cEBnbWFpbC5j
b20+iJYEExYIAD4WIQTVdQRBFtfZLNSSoDiV5qedexkKxQUCXw8Q9gIbAwUJCWYB
gAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRCV5qedexkKxRsXAPkBkLsb1AXG
sPNdG5W11Sw5X40prgH3QxqB1GVv+y43uwEAxPjXh7ulz9TCtJK6H23jm2TpJdO2
k7WMX6WDknJP2AO4OARfDxD2EgorBgEEAZdVAQUBAQdAN7MwsW6QIYSo5vlws56s
6FyV7uQOG/8M75F0VERvwmkDAQgHiH4EGBYIACYWIQTVdQRBFtfZLNSSoDiV5qed
exkKxQUCXw8Q9gIbDAUJCWYBgAAKCRCV5qedexkKxYoAAQCz7w5OiZMU+bB4dscF
@majudhu
majudhu / grub
Created February 3, 2022 20:13
/etc/default/grub asus ux331 mx150
GRUB_DEFAULT=saved
GRUB_TIMEOUT=1
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=1 security=apparmor udev.log_priority=3 udev.log_priority=3 noirqdebug pci=noaer i915.enable_psr=0 idle=nomwait i915.enable_dc=0 i915.enable_fbc=0 processor.max_cstate=1 rcu_nobs=0-11 i915.enable_gvt=1 kvm.ignore_msrs=1"
GRUB_CMDLINE_LINUX=""
# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true
@majudhu
majudhu / etc-danted.conf
Last active February 27, 2022 07:56
git npm ssh socks proxy
internal: 0.0.0.0 port=8888
external: eth0
socksmethod: none
clientmethod: none
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
}
@majudhu
majudhu / strapi.js
Created August 23, 2022 21:14
Strapi Wrappers for Next.js
const API_URL = 'http://localhost:1337/api/';
const OPTIONS = { headers: { Authorization: `Bearer ${TOKEN}` } };
async function query(path) {
return (await fetch(API_URL + path, OPTIONS)).json();
}
export async function getList(path) {
const data = await query(path);
return data.data.map(({ id, attributes }) => ({ id, ...attributes }));