Skip to content

Instantly share code, notes, and snippets.

View alibakhtiar's full-sized avatar
🏠
Working from home

Ali Bakhtiar alibakhtiar

🏠
Working from home
View GitHub Profile
@danielbierwirth
danielbierwirth / TCPTestClient.cs
Last active April 5, 2024 21:57
TCP Client-Server Connection Example | Unity | C# | Bidirectional communication sample: Client can connect to server; Client can send and receive messages: Server accepts clients; Server reads client messages; Server sends messages to client
// This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/
// or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using UnityEngine;
@pqina
pqina / create-thumbnail.php
Last active June 29, 2023 18:13
Create thumbnails with PHP
<?
// Link image type to correct image loader and saver
// - makes it easier to add additional types later on
// - makes the function easier to read
const IMAGE_HANDLERS = [
IMAGETYPE_JPEG => [
'load' => 'imagecreatefromjpeg',
'save' => 'imagejpeg',
'quality' => 100
@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active February 21, 2024 03:02
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@alibo
alibo / iran-sanctions_blocker-sites.csv
Last active April 24, 2024 10:04
List of sites which block IPs come from Iran [UPDATING... (July 16, 2020)] #SANCTIONS
Title URI
Flurry by Yahoo https://dev.flurry.com/secure/signup.do
Google NikCollection https://dl.google.com/edgedl/photos/nikcollection-full-1.2.11.dmg
Bitbucket http://bitbucket.org/
SoftLayer http://softlayer.com/
VirtualBox http://download.virtualbox.org/virtualbox/5.0.16/VirtualBox-5.0.16-105871-OSX.dmg
Docker Hub https://hub.docker.com/
Oracle http://oracle.com/
Java http://java.com
Sun http://sun.com
@aagontuk
aagontuk / red-black-tree.c
Last active October 17, 2022 05:53
A RED-BLACK TREE Implementation
/*
* [PROG] : Red Black Tree
* [AUTHOR] : Ashfaqur Rahman <sajib.finix@gmail.com>
* [PURPOSE] : Red-Black tree is an algorithm for creating a balanced
* binary search tree data structure. Implementing a red-balck tree
* data structure is the purpose of this program.
*
* [DESCRIPTION] : Its almost like the normal binary search tree data structure. But
* for keeping the tree balanced an extra color field is introduced to each node.
* This tree will mantain bellow properties.
@denji
denji / nginx-tuning.md
Last active April 26, 2024 11:21
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@willurd
willurd / web-servers.md
Last active April 26, 2024 12:46
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@JSchaenzle
JSchaenzle / RapidXmlExample.c
Created May 18, 2012 18:37
RapidXml example parsing beer journal
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include "rapidxml-1.13/rapidxml.hpp"
using namespace rapidxml;
using namespace std;