Skip to content

Instantly share code, notes, and snippets.

View ms747's full-sized avatar
😎

Mayur Shah ms747

😎
  • India
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Clustered Mapbox Map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox-gl-js/v2.8.2/mapbox-gl.js'></script>
<script src="https://unpkg.com/supercluster@8.0.0/dist/supercluster.min.js"></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.8.2/mapbox-gl.css' rel='stylesheet' />
<style>
import flask
import os
import psycopg2
import geojson
from dotenv import load_dotenv
from flask_cors import CORS
load_dotenv()
DB_NAME = os.getenv("DB_NAME")
@ms747
ms747 / io_main.c
Last active October 24, 2023 11:05
IO_Uring server
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <unistd.h>
@ms747
ms747 / poll_server.c
Created October 24, 2023 10:32
Poll Server
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/epoll.h>
#define PORT 8080
#define MAX_EVENTS 256
@ms747
ms747 / init.lua
Created March 5, 2023 16:44
Basic goto neovim config
local set = vim.opt
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
// build.rs
use std::env;
use std::fs;
use std::path::Path;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("routes.rs");
let src_path = Path::new("src/pages");
#!/bin/bash
# USAGE
# ./aoc_get_input [day_number] >> input.txt
SESSION="session=?????"
if [ -z "$1" ]
then
echo "No argument supplied"
@ms747
ms747 / raw_pointer_multithread.rs
Created November 22, 2022 08:57
Access array between threads without Arc/Mutex
use std::thread::spawn;
fn main() {
let mut threads = vec![];
let my_array: &'static [u8; 16] = Box::leak(Box::new([0; 16]));
for i in 0..4 {
let thread = spawn(move || {
let my_array = my_array.as_ptr() as *mut u8;
unsafe {
@ms747
ms747 / doom.sh
Created October 12, 2022 19:58
Dooms Script
#!/bin/bash
DOOM=$(date -d "30 Oct 22" +%s)
NOW=$(date +%s)
if [[ $NOW -gt $DOOM ]]; then
echo "WORKS"
fi
@ms747
ms747 / init.lua
Created October 28, 2021 12:46
Basic Neovim Lua config
local global = vim.g
local option = vim.o
local set = vim.opt
local map = vim.api.nvim_set_keymap
-- Set conceallevel = 0
vim.api.nvim_exec("autocmd BufEnter *.json set conceallevel=0", false)
vim.api.nvim_exec("autocmd BufEnter *.json set concealcursor=n", false)
-- Tabs Settings