Skip to content

Instantly share code, notes, and snippets.

View amrography's full-sized avatar
🚀
...

Amro Khaled amrography

🚀
...
View GitHub Profile
@JonBons
JonBons / reverse-ssh.md
Created August 25, 2021 21:54 — forked from harshilpatel312/reverse-ssh.md
Alternative to VPN: reverse-ssh + autossh

Description

You want to access a remote computer from a local computer. The remote computer does not have a public IP, is on its own local network and can access internet.

Solution: To access the remote computer, you need a middleman (proxy server) which is accessible by both, the remote and the local computer. You open an ssh tunnel from remote to middleman. Use that ssh tunnel on local to access the remote computer.

Method

  1. Create VM on a cloud service (like https://www.digitalocean.com/products/droplets/). Get its public IP and password.
  • As a test, access the VM from local computer: ssh [email protected]. If successful, proceed. If not, inspect.
@jeremycastelli
jeremycastelli / Storage.ts
Created October 27, 2020 10:42
vuex persist capacitor SQLite storage
import { Plugins } from '@capacitor/core';
import 'capacitor-data-storage-sqlite';
export function useStorage(options: any = {}) {
const { CapacitorDataStorageSqlite } = Plugins;
const storage: any = CapacitorDataStorageSqlite;
let opened = false;
const openStorage = async (): Promise<boolean> => {
<?php
ini_set('pcre.backtrack_limit', '10000000');
$url = 'https://ru.tradingview.com/chart/VIX/veShLNLq-vix/'; // Ссылка на торговую идею trading view
$filename = dirname(__FILE__) . '/candles.json'; // Путь к файлу, в который будут сохранены свечи
$html = file_get_contents($url);
if (empty($html)) {
@kellenmace
kellenmace / remove-duplicate-objects-from-array.php
Created February 2, 2019 16:21
If you have an indexed array of objects, and you want to remove duplicates by comparing a specific property in each object, a function like the remove_duplicate_models() one below can be used.
<?php
class Car {
private $model;
public function __construct( $model ) {
$this->model = $model;
}
public function get_model() {
@poul-kg
poul-kg / valet.conf
Last active July 2, 2025 19:35
CORS Rules for Laravel Valet Nginx
# To enable CORS you should add lines with CORS rules below to your valet.conf file
# Find the file /usr/local/etc/nginx/valet/valet.conf - this is Valet conf for Nginx
# of try to execute `locate valet.conf` and find the `valet.coinf` in `nginx` subdirectory
# after you edit your valet.conf do not forget to execute `valet restart`
server {
listen 80 default_server;
root /;
charset utf-8;
client_max_body_size 128M;
@vjt
vjt / 2fa
Last active May 12, 2023 11:28
2FA from the mac command line using oathtool-toolkit without much fuss
#!/bin/bash
# -*- 2fa Command Line -*-
#
# Uses oath-toolkit http://nongnu.org/oath-toolkit/
# to generate 2FA OTPs and copies them in the Mac's
# clipboard using pbcopy(1). For other UNIX systems
# you can just strip the pbcopy at the bottom.
#
# In the dir below you should put TOTP token seeds,
@Razoxane
Razoxane / laravel_conditional_index_migration.php
Created August 8, 2017 01:35
Laravel - Create Index If Not Exists / Drop Index If Exists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class LaravelConditionalIndexMigration extends Migration
{
/**
* Run the migrations.
@stirtingale
stirtingale / instagram_id_to_url.php
Last active November 18, 2019 08:13
Simple PHP function to convert an Instagram ID into a URL.
// based on ggwarpig stackoverflow anwser to
// "Where do I find the Instagram media ID of a image"
// @ https://stackoverflow.com/a/37246231
function instagram_id_to_url($instagram_id){
$url_prefix = "https://www.instagram.com/p/";
if(!empty(strpos($instagram_id, '_'))){
@ndbroadbent
ndbroadbent / rn-i18n-locale-identifiers.csv
Last active March 28, 2025 09:12 — forked from JaseHadd/ioslocaleidentifiers.csv
React Native i18n Locale Identifiers
Locale Identifier Description
af Afrikaans
af-NA Afrikaans (Namibia)
af-ZA Afrikaans (South Africa)
agq Aghem
agq-CM Aghem (Cameroon)
ak Akan
ak-GH Akan (Ghana)
am Amharic
am-ET Amharic (Ethiopia)
@noelboss
noelboss / git-deployment.md
Last active June 9, 2025 10:11
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.