Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Rock'nRolla

Alireza Savand Alir3z4

💭
Rock'nRolla
View GitHub Profile
@Alir3z4
Alir3z4 / firewall.sh
Last active Dec 16, 2020
firewall.sh
View 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 Jan 16, 2020 — forked from dmutende/oauth2_graphql_readme.txt
Warpping GraphQL endpoints with Django OAuth2 Toolkit's ProtectedResourceView to secure them using OAuth2.0
View oauth2_graphql_readme.txt
- 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 Feb 11, 2019
Will format the given number by $precision and separated by $separator.
View numberFormatPrecision.php
<?php
/**
* numberFormatPrecision
*
* Will format the given number by $precision and separated by $separator.
*
* @param string|int|float $number
* @param int $precision
* @param string $separator
View middlewares.go
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 Dec 16, 2020
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers.
View flatten.py
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 Dec 29, 2017
Put this before "app themes"
View functions.php
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;
}
View features.md

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 Dec 16, 2020
RDP + Midori browser Ubuntu 16.04
View install.sh
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 Nov 7, 2016
Invoice and Payment helpers that I've used on Kloud51
View LICENSE
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
@Alir3z4
Alir3z4 / HelloWorld.java
Created Oct 29, 2016
Spark Java Quick Start
View HelloWorld.java
import static spark.Spark.*;
public class HelloWorld {
public static void main(String[] args) {
get("/hello", (req, res) -> "Hello World");
}
}
// Fire it up: http://localhost:4567/hello