Skip to content

Instantly share code, notes, and snippets.

View mberneti's full-sized avatar
🎯
Focusing

mohammadreza berneti mberneti

🎯
Focusing
View GitHub Profile
@mahmoud-eskandari
mahmoud-eskandari / README.md
Last active August 8, 2024 13:26
Install v2ray on Bridge:(Ubuntu +18 via systemd) - Upstream (Ubuntu +18/CentOS +7 via docker)

پنل x-ui

پنل تحت وب مدیریت V2ray و ساخت کاربر و مدیریت سرور

mkdir x-ui && cd x-ui
docker run -itd --network=host \
    -v $PWD/db/:/etc/x-ui/ \
 -v $PWD/cert/:/root/cert/ \
@flavienbonvin
flavienbonvin / dynamic_imports.tsx
Created March 29, 2022 18:28
NextJS optimisation gist
const ServiceBadge = dynamic(() => import(‘../Molecules/ServiceBadge’))
const ServiceHeader = ({service, title}: Props) => {
const router = useRouter()
const isMobile = useBreakpointValue([true, null, false], ‘base’)
return (
<HStack>
<BackButton onClick={() => router.replace(ROUTE_ROOT)} />
{isMobile && <ServiceBadge {…service} />}
@gaearon
gaearon / Classes.js
Created May 27, 2020 17:38
Beneath Classes: Prototypes
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
}
}
let miles = new Spiderman();
miles.lookOut();
@luispuerto
luispuerto / r_ubuntu.sh
Last active December 19, 2020 16:16 — forked from ElToro1966/r_ubuntu_18_04.sh
Install R and RStudio on Ubuntu 19.10 with essential libraries for data science. Based on pachamaltese/r_ubuntu_17_10.sh (for Ubuntu 17.10). Note: You need to make sure the default library location - /usr/local/lib/R/site-packages - is writable .
# Add repo to install the last R
sudo apt install apt-transport-https software-properties-common
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu eoan-cran35/'
# Install R
sudo apt update
sudo apt install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
@ctchuang
ctchuang / Dockerfile
Last active April 19, 2020 07:52
Dockerfile for Jupiter notebook and nvidia-docker
# See all tag variants at https://hub.docker.com/r/tensorflow/tensorflow/tags/
FROM tensorflow/tensorflow:latest-gpu-py3-jupyter
RUN pip install keras
RUN pip install Pillow
# -m option creates a fake writable home folder for Jupyter.
RUN groupadd -g 1000 justin && \
useradd -m -r -u 1000 -g justin justin
USER justin
@andfaulkner
andfaulkner / AngleBetween3PointsIn3DSpace.js
Last active November 3, 2023 15:26
Get the angle between 3 coordinates (x, y, z) in 3D space
/**
* Calculate angle between 3 points in 3D space.
* Note: assumes we want 1 vector to run from coord1 -> coord2, and the other
* from coord3 -> coord2.
*
* @param {x: number; y: number; z: number} coord1 1st (3D) coordinate
* @param {x: number; y: number; z: number} coord2 2nd (3D) coordinate
* @param {x: number; y: number; z: number} coord3 3rd (3D) coordinate
*
* @return {number} Angle between the 3 points
@tomsihap
tomsihap / gist:e703b9b063ecc101f5a4fc0b01a514c9
Created December 23, 2018 14:46
Install NVM in Ubuntu 18.04 with ZSH
# Find the latest version on https://github.com/creationix/nvm#install-script
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
# Add in your ~/.zshrc the following:
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
$ source ~/.zshrc
import numpy as np
import tensorflow as tf
tf.enable_eager_execution()
X_raw = np.array([2013, 2014, 2015, 2016, 2017], dtype=np.float32)
y_raw = np.array([12000, 14000, 15000, 16500, 17500], dtype=np.float32)
X = (X_raw - X_raw.min()) / (X_raw.max() - X_raw.min())
y = (y_raw - y_raw.min()) / (y_raw.max() - y_raw.min())
@aenain
aenain / analyze_modules.js
Last active December 7, 2022 21:26
JS script to visualize ES6 circular dependencies by producing a directed graph using dot notation.
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@madskristensen
madskristensen / ETagMiddleware.cs
Last active September 11, 2024 18:38
ASP.NET Core ETAg middleware
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Net.Http.Headers;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
public class ETagMiddleware
{