Skip to content

Instantly share code, notes, and snippets.

View hasanisaeed's full-sized avatar
💥
I wake up early and work hard :)

Saeed hasanisaeed

💥
I wake up early and work hard :)
View GitHub Profile
@mhrlife
mhrlife / gcra.lua
Created November 7, 2023 16:09
GCRA Rate limiter implementation with Lua
redis.replicate_commands()
local rate_limit_key = KEYS[1]
local burst = ARGV[1]
local emission_interval = tonumber(ARGV[2])
-- calculating time using this idea (https://github.com/rwz/redis-gcra/blob/master/vendor/perform_gcra_ratelimit.lua)
local jan_1_2017 = 1483228800
local now = redis.call("TIME")
now = (now[1] - jan_1_2017) + (now[2] / 1000000)
@hakerdefo
hakerdefo / sources.list
Last active June 29, 2024 03:19
Ubuntu 22.04 LTS (Jammy Jellyfish) complete sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
@asaah18
asaah18 / python guide.md
Last active November 5, 2022 16:20
a python guide/cheat-sheet intended to those who already know python and want a mind refresh or looking for a specific syntax

Python Guide

This python guide is intended to those who already know python and want a mind refresh or looking for a specific syntax.
-as this guide doesn't elaborate in explaining thing that a programmer would already know -like: variable, function, csv, json-

additionally, this guide is not intended to be a replacement for reading official Python documentation.

guide version: 2.1.0 | python version: 3.10

| Part of Version | Explanation |

@hasanisaeed
hasanisaeed / fa2EnDigits.js
Last active July 12, 2021 12:30
Convert Persian digits to English digits.
fa2EnDigits(str) {
str = String(str);
var e = '۰'.charCodeAt(0);
str = str.replace(/[۰-۹]/g, function (t) {
return t.charCodeAt(0) - e;
});
e = '٠'.charCodeAt(0);
str = str.replace(/[٠-٩]/g, function (t) {
return t.charCodeAt(0) - e;
});
@hasanisaeed
hasanisaeed / make_app.sh
Created June 29, 2021 12:40
Generate APK file without IDE
#!/bin/bash
#mkdir -p { src/com/example/hellovirgool, obj, bin, res/layout, res/values, res/drawable}
#Define the help function
function help() {
echo "Options:"
echo "-package Package Name"
echo "-sdk SDK Path"
echo "-name Application Name"
@GerardMaggiolino
GerardMaggiolino / simplecar.urdf
Created May 16, 2019 02:24
Completed URDF specified toy car.
<?xml version="1.0"?>
<robot name="simplecar">
<!-- Colors -->
<material name="black">
<color rgba="0 0 0 1"/>
</material>
<material name="blue">
<color rgba="0.6 0.7 0.8 1"/>
</material>
@raisiqueira
raisiqueira / fileUpload.vue
Created December 22, 2017 13:06
Simple file upload with Vue and Axios
<style>
input[type="file"]{
position: absolute;
top: -500px;
}
div.file-listing{
width: 200px;
}
@bvis
bvis / Jenkinsfile
Last active January 3, 2023 20:45
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@urigoren
urigoren / LSTM_Binary.py
Last active June 22, 2023 19:37
LSTM Binary classification with Keras
from keras.layers import Dense, Dropout, LSTM, Embedding
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential
import pandas as pd
import numpy as np
input_file = 'input.csv'
def load_data(test_split = 0.2):
print ('Loading data...')