Skip to content

Instantly share code, notes, and snippets.

View bezzad's full-sized avatar
:octocat:
Hi

Behzad Khosravifar bezzad

:octocat:
Hi
View GitHub Profile
@mahmoud-eskandari
mahmoud-eskandari / README.md
Last active February 28, 2024 00:27
Install v2ray on Bridge:(Ubuntu +18 via systemd) - Upstream (Ubuntu +18/CentOS +7 via docker)

پنل x-ui

پنل تحت وب مدیریت V2ray و ساخت کاربر و مدیریت سرور

mkdir x-ui && cd x-ui
docker run -itd --network=host \
    -v $PWD/db/:/etc/x-ui/ \
 -v $PWD/cert/:/root/cert/ \
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 18, 2024 18:28
Minimal APIs at a glance
@andrebrait
andrebrait / keychron_linux.md
Last active May 19, 2024 16:00
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@jbe2277
jbe2277 / DiscoveryService.cs
Last active September 4, 2021 10:50
[Xamarin, MAUI] Parse IPAddress provided by iOS NetServiceBrowser (supports IPv4 and IPv6)
private void ServiceAddressResolved(object sender, EventArgs e)
{
var service = (NSNetService)sender;
var addresses = service.Addresses.Select(x => x.ToArray()).ToArray();
var ipAddress = GetIPAddress(addresses.First()); // Consider that resolve might provide multiple IP addresses
// ...
}
private static IPAddress? GetIPAddress(byte[] data)
{
@bezzad
bezzad / BinarySearch
Last active October 22, 2019 07:07
Binary search implementation to search a value of type T1 within a list of T2 type which comparable by value argument.
using System;
using System.Collections.Generic;
public static class Helper
{
/// <summary>
/// Searches a section of the list for a given element using a binary search
/// algorithm.
/// </summary>
/// <param name="items">list of <see cref="TItems"/>, which must be searched within</param>
@selcukusta
selcukusta / Dockerfile
Last active June 11, 2023 08:01
Using MS font family in Debian 9 based ASP.NET Core Docker images
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim as runtime
RUN apt-get update && \
apt-get install -y wget \
fontconfig && \
wget http://ftp.br.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.6_all.deb && \
apt --fix-broken install -y ./ttf-mscorefonts-installer_3.6_all.deb && \
rm ttf-mscorefonts-installer_3.6_all.deb && \
fc-cache -f -v
import requests
import json
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
query = 'http://members.tsetmc.com/tsev2/chart/data/Financial.aspx'
params = {
'i': '18027801615184692',
't': 'ph',
@bezzad
bezzad / animation-using-angularjs-ui-router-and-nganimate.markdown
Last active November 10, 2018 08:16
Animation using AngularJS ui-router and ngAnimate

Animation using AngularJS ui-router and ngAnimate

Feel free to use this code if you are using AngularJS Framework in your application. This will help you easily create beautiful animated wizards or cover other UI scenarios that require a step-by-step interactions. Better used for single-page apps.

A Pen by Behzad Khosravifar on CodePen.

License.

@bezzad
bezzad / StartIIS.cs
Created July 22, 2018 10:32
Programmatically start IIS Express from code.
public static class IISExpress
{
private static readonly List<string> sites = new List<string>();
private static readonly List<string> paths = new List<string>();
public static void StartIISExpress(string site, int port = 7329)
{
if(!sites.Contains(site.ToLower()))
sites.Add(site.ToLower());
else return;
@bezzad
bezzad / ObservableConcurrentDictionary.cs
Last active July 22, 2018 10:30
Provides a thread-safe dictionary for use with data binding.
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Threading;
namespace System.Collections.Generic
{
/// <summary>