Skip to content

Instantly share code, notes, and snippets.

View djnotes's full-sized avatar
🎯
Focusing

Mehdi Haghgoo djnotes

🎯
Focusing
View GitHub Profile
@djnotes
djnotes / khayam-pascal-triangle.c
Created May 2, 2024 07:29
C Program to Draw Khayam-Pascal Triangle
/**
C Program to draw Khayam-Pascal Triangle
Copyright (C) 2024 Mehdi Haghgoo
*/
#include<stdio.h>
#define COLS 80
#define ROWS 40
<?php
//Use this file to create a simple bot/userbot that receives message and
// channel updates and notifies the specified admin about it
use danog\MadelineProto\EventHandler;
use danog\MadelineProto\Tools;
use danog\MadelineProto\API;
use danog\MadelineProto\Logger;
use danog\MadelineProto\Settings;
@djnotes
djnotes / dialogbot.php
Created January 30, 2023 05:40
Get dialogs and display in the form Message - PeerType - PeerID
<?php
// include __DIR__ . '/vendor/autoload.php';
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
require_once 'madeline.php';
use \danog\MadelineProto\API;
@djnotes
djnotes / Landing.kt
Last active October 26, 2022 07:23
Simple login screen definition in Jetpack Compose
package com.droidcon.yourapp.ui.screens
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.AccountCircle
import androidx.compose.material.icons.outlined.Login
import androidx.compose.material3.Button
@djnotes
djnotes / getchats.php
Created July 16, 2022 18:58
Small gist to work with chats based on MadelineProto
<?php
include __DIR__ . '/vendor/autoload.php';
/**
* This script does 3 things. Get the last `DIALOGS_LIMIT` dialogs of the current user,
* gets information about a chat,
* get the last `HISTORY_LIMIT` messages within a specific chat
*
@djnotes
djnotes / SwipeableSample.kt
Last active May 18, 2022 08:24
A small sample showing the use of swipeable Modifier in Jetpack Compose
@Composable
fun SwipeableSample(){
//Adapted from original Android CS sample https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/material/material/samples/src/main/java/androidx/compose/material/samples/SwipeableSamples.kt
// Draw a slider-like composable consisting of a red square moving along a
// black background, with three states: "A" (min), "B" (middle), and "C" (max).
val width = 300.dp
val squareSize = 100.dp
val swipeState = rememberSwipeableState(Machine.Off)
val lengthPx = with(LocalDensity.current) { (width - squareSize).toPx() }

Installing Docker Desktop on Fedora

1- Get Docker Engine CE installed on Fedora

sudo dnf config-manager \
    --add-repo \
    https://download.docker.com/linux/fedora/docker-ce.repo

sudo dnf install docker-ce docker-ce-cli containerd.io docker-compose-plugin

@djnotes
djnotes / Dockerfile
Created August 30, 2020 07:12
Dockerfile for MadelineProto using the Fedora 32 Docker image
FROM fedora:32
RUN dnf update -y
RUN dnf install -y git composer php php-devel php-zip php-cli php-mbstring php-xml php-intl php-json php-gmp
@djnotes
djnotes / gist:0310397f0e301197bb41495fd730e2d6
Created July 21, 2020 13:15
Complex text containing Persian text to show the use of full-width and zero-width spaces
می روم
= I am going
می روی
= You are going
می خورد
= He/She/It is eating
می گوید
= He/She/It is saying
می گفت
= He/She/It was saying (would say).
@djnotes
djnotes / # php - 2019-10-17_03-10-06.txt
Created October 17, 2019 08:33
php on macOS 10.15 - Homebrew build logs
Homebrew build logs for php on macOS 10.15
Build date: 2019-10-17 03:10:06