Skip to content

Instantly share code, notes, and snippets.

View asim's full-sized avatar
🌍

Asim Aslam asim

🌍
View GitHub Profile
@asim
asim / new
Created April 18, 2023 09:46
hmm
1 BingPreview/1.0b"
1 (compatible;PetalBot;+https://webmaster.petalsearch.com/site/petalbot)"
1 "curl/7.58.0"
1 "Java/11.0.13"
1 PetalBot;+https://webmaster.petalsearch.com/site/petalbot)"
2 "curl/7.68.0"
2 [FB_IAB/FB4A;FBAV/353.0.0.34.116;]"
2 +http://www.google.com/bot.html)"
2 OPR/83.0.4254.27"
3 "adalo-database"
@asim
asim / read.go
Last active February 8, 2022 12:15
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Read data from a table. Lookup can be by ID or via querying any field in the record.
type Db interface {
Count(*CountRequest) (*CountResponse, error)
Create(*CreateRequest) (*CreateResponse, error)
Delete(*DeleteRequest) (*DeleteResponse, error)
DropTable(*DropTableRequest) (*DropTableResponse, error)
ListTables(*ListTablesRequest) (*ListTablesResponse, error)
Read(*ReadRequest) (*ReadResponse, error)
RenameTable(*RenameTableRequest) (*RenameTableResponse, error)
Truncate(*TruncateRequest) (*TruncateResponse, error)
Update(*UpdateRequest) (*UpdateResponse, error)
@asim
asim / db.go
Created February 8, 2022 12:06
package main
import (
"fmt"
"os"
"go.m3o.com/db"
)
// Create a record in the database. Optionally include an "id" field otherwise it's set automatically.
@asim
asim / verify.go
Last active February 8, 2022 11:33
package main
import (
"fmt"
"os"
"go.m3o.com/user"
)
// Send a verification email
package main
import (
"fmt"
"os"
"go.m3o.com/user"
)
// Create a new user account. The email address and username for the account must be unique.
@asim
asim / osrm.sh
Last active April 27, 2021 10:09
Builds the OSRM Planet
#!/bin/bash
# chkconfig: 345 20 80
# description: Builds and runs OSRM
# This script builds OSRM Planet
# It will create builds for 3 profiles; car, bike, foot
# There is not any backup as of yet
# Source function library.
@asim
asim / micro.tsx
Created March 15, 2021 14:59
A function to call the Micro API
export var BaseURL = 'http://localhost:8080'
if(process.env.MICRO_API_ENDPOINT?.length) {
BaseURL = process.env.MICRO_API_ENDPOINT
}
// call makes HTTP JSON calls to the Micro API. If the request succeeds (200), the response body is
// returned, otherwise the error is parsed from the response body and returned in the reject. If no
// error is returned in the response body, the response status text is returned.
export default function call(path: string, params?: any): Promise<any> {
return new Promise<any>((resolve: any, reject: any) => {
@asim
asim / groups.tsx
Created March 15, 2021 14:49
Loading groups in Distributed
import { NextApiRequest, NextApiResponse } from 'next'
import call, { BaseURL } from '../../../../lib/micro'
import TokenFromReq from '../../../../lib/token'
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { query: { group_id } } = req
if(req.method !== 'GET' && req.method !== 'PATCH') {
res.status(405)
return