Skip to content

Instantly share code, notes, and snippets.

View fhdalikhan's full-sized avatar
🏠
Working from home

Fahad Ali Khan fhdalikhan

🏠
Working from home
  • Karachi, Pakistan.
View GitHub Profile
@fhdalikhan
fhdalikhan / help
Last active August 9, 2022 15:08
docker solr 4 running instructions
some helpful instructions when I have to change my laptop
clone solr 4 image from https://github.com/fhdalikhan/docker-solr4
on windows don't use git bash, use windows terminal with ubuntu using WSL 2, otherwise will get erros due to line endings being CRLF, which should be LF instead.
build using:
docker build -t solr4 .
run using:
@Tynael
Tynael / README.md
Last active January 22, 2024 01:06
How to use npx to run gist based scripts
@ralphschindler
ralphschindler / AuthServiceProvider.php
Last active April 5, 2019 09:04
Laravel 5.8 Policy Guesser For Using "Models" Directory
<?php
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
@marcwjj
marcwjj / mosh-setup-guide.md
Last active November 12, 2023 12:17
Step by step guide to setup mosh ssh client to Google Cloud VM instance

A beginner's guide to setup Mosh roaming terminal on Mac to access Google Cloud Compute Engine instance

Being new to training ML models using Google Cloud VM instances, I faced issues where my ssh connection to the cloud instance (using either the clound web-based ssh client or using cloud shell) would disconnect from time to time (for example when I power off my laptop or the network gets disconnected) which would terminate the model training process. Therefore I searched for a ssh client that can handle disconnection and can resume connection without disrupting the process running on the server and came across with Mosh mobile shell, a remote terminal app that supports roaming.

It took me a while to figure out how to set up a third party ssh terminal using the google cloud OAuth. Here's a step-by-step guide:

Update: a simpler alternative for persisting remote sessions

Since this writing, another Mosh user kindly advised me that using terminal multiplexer co

@goodwill
goodwill / cloud-sql-proxy.service
Last active December 15, 2023 06:37
Example Systemd file for starting cloud sql proxy at system start
[Install]
WantedBy=multi-user.target
[Unit]
Description=Google Cloud Compute Engine SQL Proxy
Requires=networking.service
After=networking.service
[Service]
Type=simple
@paulredmond
paulredmond / states.js
Created December 27, 2017 18:28
US States for a JS Dropdown
var states = [
{
label: 'Alabama',
value: 'AL'
},
{
label: 'Alaska',
value: 'AK'
},
{
@geraldvillorente
geraldvillorente / import.md
Created June 14, 2017 05:03
How to import database in MySQL in Docker?

This is a simple way of importing MySQL database in Docker.

  1. In you Dockerfile you must have a shared folder. Shared folder is a directory in your host machine that is mounted to Docker instance.

  2. Put the exported sql file in the shared folder.

  3. Login to your Docker instance via docker exec -it DOCKER_CONTAINER_ID bin/bash.

  4. Login to MySQL via mysql -u USERNAME -p.

@ethanpil
ethanpil / wp-secure.conf
Created May 12, 2017 16:16
Wordpress Security for NginX
# wp-secure.conf
#
#
# This file includes common security considerations for wordpress using nginx.
#
# The goal is to block actions which are usually dangerous to wordpress.
# Additionally, we block direct access to PHP files and folders which should not
# be accessed directly from a browser.
#
# Also have included exceptions for plugins that are known to require this access.
@kujiy
kujiy / git-bash.exe-args
Last active April 20, 2023 13:55
How to open a specific folder with git-bash.exe from a command line(shell)
With argument
"C:\Program Files\Git\git-bash.exe" "--cd=%1"
Direct
"C:\Program Files\Git\git-bash.exe" "--cd="C:\YOUR\FOLDER\"
@alfredoem
alfredoem / pdf-example.blade.php
Created November 3, 2015 19:17
Template for a invoice render with DomPDF
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Aloha!</title>
<style type="text/css">
* {
font-family: Verdana, Arial, sans-serif;
}