Skip to content

Instantly share code, notes, and snippets.

View arashatt's full-sized avatar

Arash Attari arashatt

  • Iran-mashhad
  • 16:11 (UTC +03:30)
View GitHub Profile
# This file is maintained as an up-to-date snapshot of the default
# homeserver.yaml configuration generated by Synapse. You can find a
# complete accounting of possible configuration options at
# https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
#
# It is *not* intended to be copied and used as the basis for a real
# homeserver.yaml. Instead, if you are starting from scratch, please generate
# a fresh config using Synapse by following the instructions in
# https://element-hq.github.io/synapse/latest/setup/installation.html.
#
@arashatt
arashatt / init.lua
Created January 26, 2025 22:04
Neovim configuration
--[[
Neovim configuration file using Packer.lua
This configuration includes support for:
- Git
- Rust language
- JavaScript
- LaTeX
@arashatt
arashatt / auth-axum.rs
Last active January 23, 2025 14:25
generated my gemini
use axum::{
extract::{Extension, Json, State},
http::StatusCode,
middleware::{self, Next},
response::{IntoResponse, Response},
routing::{get, post},
Router,
};
use jsonwebtoken::{decode, encode, Algorithm, DecodingKey, EncodingKey, Header, Validation};
use serde::{Deserialize, Serialize};
<?php
if (class_exists('Memcache')) {
// Create a new Memcache instance
$memcache = new Memcache();
// Add a Memcache server
$memcache->connect('127.0.0.1', 11211);
// Test storing a value
$key = 'test_key';
@arashatt
arashatt / gist:5ceb25b4972351440ab54fd87da57961
Created March 29, 2024 23:55
how to copy a file into clipboard in linux without selecting text with mouse
xclip -selection c < file_name.extension
sometimes the content of the file get too big and it's not easy to select the text you want to copy with mouse. this command
is a handy way to do that.
@arashatt
arashatt / app.py
Created March 29, 2024 23:53
upload server (python - flask - code ) it should have index.html in the same directory to POST files
from flask import Flask, request, jsonify, make_response, send_from_directory
from werkzeug.utils import secure_filename
import os
import secrets # For secure random filename generation
app = Flask(__name__)
UPLOAD_FOLDER = "uploads" # Change this to your desired upload folder
ALLOWED_EXTENSIONS = set(['mkv', 'txt', 'pdf', 'jpg', 'png']) # Allowed file extensions
@arashatt
arashatt / gist:77110bea1fd5ce9ed5b820302ab1f631
Last active August 25, 2023 23:31
some code and script concerning php
> php -S localhost:8000
to run php in a directory.
> SELECT user FROM mysql. user;
> or SELECT user,host FROM mysql. user;
in mysql to list users.
Docker:
$ docker system df
to run df (viewing filesystem usage) on docker.
@arashatt
arashatt / solve.cpp
Last active December 20, 2020 13:46
تخمین رتبه
#include<iostream>
#include<queue>
#include<cassert>
using namespace std;
int main() {
queue<int>myQueue;
int n, k;
int temp;
scanf( "%d %d", &k, &n);
int MAX_K = 1000000000;