Skip to content

Instantly share code, notes, and snippets.

View Alir3z4's full-sized avatar
💭
Rock'nRolla

Alireza Savand Alir3z4

💭
Rock'nRolla
View GitHub Profile
import os
import pickle
import warnings
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from tensorflow.keras.callbacks import EarlyStopping
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Dropout
@Alir3z4
Alir3z4 / firewall.sh
Last active September 22, 2024 21:10
firewall.sh
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -F
iptables -t mangle -F
iptables -F
iptables -X
ip6tables -P INPUT ACCEPT
ip6tables -P FORWARD ACCEPT
@Alir3z4
Alir3z4 / oauth2_graphql_readme.txt
Created January 16, 2020 16:35 — forked from dmutende/oauth2_graphql_readme.txt
Warpping GraphQL endpoints with Django OAuth2 Toolkit's ProtectedResourceView to secure them using OAuth2.0
- create a .py file with 2 classes (OAuth2ProtectedResourceMixin and OAuth2ProtectedGraph). see 'utils.py' file
- then in your Django's 'urls.py', wrap the graphql endpoint. see 'urls.py.
@Alir3z4
Alir3z4 / numberFormatPrecision.php
Created February 11, 2019 15:46
Will format the given number by $precision and separated by $separator.
<?php
/**
* numberFormatPrecision
*
* Will format the given number by $precision and separated by $separator.
*
* @param string|int|float $number
* @param int $precision
* @param string $separator
func Notify(logger *log.Logger) Adapter {
return func(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
logger.Println("before")
defer logger.Println("after")
h.ServeHTTP(w, r)
})
}
}
@Alir3z4
Alir3z4 / flatten.py
Last active December 16, 2020 12:57
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers.
from typing import List
def flatten_list(items: List) -> List[int]:
"""
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers.
e.g. [[1,2,[3]],4] -> [1,2,3,4].
>>> nested: list = [[1, 2, [3, [4, 4, 8, [8, 8, 7]]]], 4, [], None]
>>> expected: List[int] = [1, 2, 3, 4, 4, 8, 8, 8, 7, 4]
@Alir3z4
Alir3z4 / functions.php
Created December 29, 2017 14:50
Put this before "app themes"
add_filter('appthemes_plupload_config', 'enable_plupload_multisel', 10 ,1);
function enable_plupload_multisel($app_plupload_config)
{
$app_plupload_config['plupload']['multi_selection'] = true;
return $app_plupload_config;
}
@Alir3z4
Alir3z4 / features.md
Last active December 16, 2020 12:58

How Blogging and Publishing works

Write and publish with GoNevis

Write & Publish in a second!

IMAGE: Screenshot of Dolphin with bunch of files.

We have an editor crafted for a nice experience with customization for extra productivity.

@Alir3z4
Alir3z4 / install.sh
Last active December 16, 2020 12:58
RDP + Midori browser Ubuntu 16.04
sudo apt-get update
sudo apt-get install xrdp xfce4 midori
echo xfce4-session > ~/.xsession
sudo sh -c 'echo startxfce4 >> /etc/xrdp/startwm.sh'
sudo service xrdp restart
@Alir3z4
Alir3z4 / LICENSE
Created November 7, 2016 12:02
Invoice and Payment helpers that I've used on Kloud51
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for