Skip to content

Instantly share code, notes, and snippets.

View AhmedBHameed's full-sized avatar
💭
Searching for new challenge

Ahmed HAMEED AhmedBHameed

💭
Searching for new challenge
View GitHub Profile
@JoshuaSchlichting
JoshuaSchlichting / router.go
Created December 13, 2022 00:28
A basic HTTP router
package router
import (
"encoding/json"
"html/template"
"io/fs"
"net/http"
)
var commonMiddleware = []Middleware{}
@JoshuaSchlichting
JoshuaSchlichting / build.sh
Created November 13, 2022 00:10
A build script for Golang projects
"""
A build script for golang projects
"""
APP_NAME=<your app name here>
if [[ $(uname -m) == "x86_64" ]]; then
APP_ARCH=amd64
elif [[ $(uname -m) == "i686" ]]; then
APP_ARCH=386
elif [[ $(uname -m) == "arm64" ]]; then
@marcometz
marcometz / traefik basic auth htpasswd
Last active February 22, 2025 20:56
user and password generator for traefik basic auth middleware
traefik.frontend.auth.basic.users:
echo $(htpasswd -nbB username "passwort") | sed -e s/\\$/\\$\\$/g
@festum
festum / go-code-convention.md
Last active January 25, 2025 14:44
Golang Guideline

Project Structure

The following content shows a general structure of a web app, it can be changed based on the different conventions of web frameworks.

- templates (views) # Template files
@harveyconnor
harveyconnor / a-mongodb-replica-set-docker-compose-readme.md
Last active August 12, 2024 17:25
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

@virtyaluk
virtyaluk / install.sh
Last active September 12, 2021 17:52
Getting your Raspberry Pi/Asus TinkerBoard up and running: installing essential apt packages, Golang, Node.js, Docker.
sudo su
# In case of TinkerBoard, use the `tinker-config` alternative to the rpi's raspi-config
wget https://raw.githubusercontent.com/mikerr/tinker-config/master/tinker-config
# Enable multiverse repository
sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list
apt-get update
apt-get upgrade -y
@beradrian
beradrian / proxy.js
Created January 18, 2018 18:11
CORS proxy with node-http-proxy
/** If you want to use the local development environment with the dev backend,
* this will create a proxy so you won't run into CORS issues.
* It accepts the following command line parameters:
* - port the port where the proxy will listen
* - target the DEV backend target to contact.
* Example: If you set the port to 3000 and target to https://dev.nibo.ai then
* your actual "resourceBaseUrl" in NiboSettings should be http://localhost:3000/api/v1
*/
// Define the command line options
const optionDefinitions = [
git log --all --grep="search text"
@javilobo8
javilobo8 / download-file.js
Last active March 17, 2025 14:25
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@gilbarbara
gilbarbara / ReduxRouter.jsx
Last active November 28, 2019 18:01
react-router v4 with redux
import React from 'react';
import { Router } from 'react-router-dom';
import createBrowserHistory from 'history/createBrowserHistory';
const LOCATION_CHANGE = '@@router/LOCATION_CHANGE';
export const history = createBrowserHistory();
class ReduxRouter extends React.Component {
static propTypes = {