Skip to content

Instantly share code, notes, and snippets.

View smakosh's full-sized avatar
👨‍💻
Building https://starlink-prices.com

Ismail Ghallou smakosh

👨‍💻
Building https://starlink-prices.com
View GitHub Profile
@smakosh
smakosh / flower_classifier.ipynb
Last active February 18, 2018 05:56
A simple perceptron built from scratch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smakosh
smakosh / vanilla_percepton_js.js
Created March 14, 2018 07:31
Perceptron from scratch with vanilla Js
// Sigmoid
const sigmoid = x => 1 / (1 + Math.exp(-x))
const D_sigmoid = x => sigmoid(x) * (1-sigmoid(x))
// data
const data = [
[ 5.1, 3.5, 0 ],
[ 4.9, 3. , 0 ],
[ 4.7, 3.2, 0 ],
@smakosh
smakosh / docker-help.md
Created August 16, 2018 01:27 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@smakosh
smakosh / BgImage.js
Created November 15, 2018 10:40
Gatsby-image as a background image
import Img from 'gatsby-image'
import styled from 'styled-components'
import PropTypes from 'prop-types'
export const BgImage = styled(Img)`
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: -1;
@smakosh
smakosh / countries.json
Created April 12, 2019 09:54
List of countries in arabic
[
{
"label": "آروبا",
"value": "آروبا"
},
{
"label": "أسبانيا",
"value": "أسبانيا"
},
{
@smakosh
smakosh / hexToRgba.js
Created December 5, 2019 19:47
Hex to RGBA - SC
const hexToRgb = hex => {
// http://stackoverflow.com/a/5624139
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
return r + r + g + g + b + b
})
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
return result
? {
@smakosh
smakosh / README.md
Created June 11, 2020 11:55
Change package name on a React Native app
  1. Changed project' subfolder name from: "android/app/src/main/java/<com.old_id>/" to: "android/app/src/main/java/com.new_id/"
  2. In android/app/src/main/java/MY/APP/com.new_id/MainActivity.java:, change:
package com.new_id;
  1. In android/app/src/main/AndroidManifest.xml, change:
package="com.new_id"
  1. In android/app/build.gradle, change:
const hexToRgb = hex => {
// http://stackoverflow.com/a/5624139
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i
hex = hex.replace(shorthandRegex, (m, r, g, b) => {
return r + r + g + g + b + b
})
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
return result
? {
@smakosh
smakosh / useSwitchNetwork.ts
Created December 10, 2021 22:26
A cool Switch network React hook
import { useMemo } from 'react';
const useswitchNetwork = async (
account: string | null | undefined,
nextChainId: 1 | 10 | 42 | 69,
currentChainId: number | undefined,
forceOptimism = false,
) => {
if (!account) {
return;