Skip to content

Instantly share code, notes, and snippets.

View ehsansouri23's full-sized avatar
๐Ÿ˜ƒ
Just Hope :)

Ehsan Souri ehsansouri23

๐Ÿ˜ƒ
Just Hope :)
View GitHub Profile
@acastro2
acastro2 / example.go
Last active October 26, 2024 15:50
Kafka retries with Go
package main
import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"math/rand"
"time"
@crosstyan
crosstyan / main.go
Last active January 7, 2025 02:18
A websocket based multiroom chat using golang and gin
package main
import (
"log"
"net/http"
"net/url"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
@haidoan
haidoan / createAndSignTx.go
Last active October 29, 2023 08:33
Creating raw bitcoin transaction multiple input output golang
func GetPayToAddrScript(address string) []byte {
rcvAddress, _ := btcutil.DecodeAddress(address, &chaincfg.TestNet3Params)
rcvScript, _ := txscript.PayToAddrScript(rcvAddress)
return rcvScript
}
type TXRef struct{
TXHash string
TXOutputN int
}
@ecoshub
ecoshub / IntToByteArray.go
Last active August 23, 2024 08:31
golang integer to byte array and byte array to integer function
package main
import (
"fmt"
"unsafe"
)
func main(){
// integer for convert
num := int64(1354321354812)
@Silverbaq
Silverbaq / Client.kt
Created August 31, 2019 19:54
A simple socket client in Kotlin
import java.io.OutputStream
import java.net.Socket
import java.nio.charset.Charset
import java.util.*
import kotlin.concurrent.thread
fun main(args: Array<String>) {
val address = "localhost"
val port = 9999
extern crate lambda_runtime as lambda;
extern crate alexa_sdk;
use lambda::{lambda, Context, error::HandlerError};
use alexa_sdk::{Request,Response};
use alexa_sdk::request::{IntentType, Locale};
use std::error::Error;
fn handle_help(_req: &Request) -> Result<Response,HandlerError> {
Ok(Response::new_simple("hello", "to say hello, tell me: say hello to someone"))
@weiancheng
weiancheng / download_file.kt
Last active April 7, 2020 00:28
[Android Download] #android
val file = File(filePath)
val fileOutputStream = FileOutputStream(file)
val inputStream = BufferedInputStream(URL(url).openStream())
var downloadSize = 0
val buffer = ByteArray(bufferSize)
var bufferLength: Int
while (true) {
@Silverbaq
Silverbaq / Server.kt
Created January 1, 2018 21:15
A simple socket-server written in Kotlin
package dk.im2b
import java.io.OutputStream
import java.net.ServerSocket
import java.net.Socket
import java.nio.charset.Charset
import java.util.*
import kotlin.concurrent.thread
@Kovrinic
Kovrinic / .gitconfig
Last active April 15, 2025 02:31
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "[email protected]:"]
insteadOf = git://github
@JonCole
JonCole / Redis-BestPractices-General.md
Last active March 13, 2025 14:30
Redis Best Practices

Some of the Redis best practices content has moved

This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.

NOTE: Client specific guidance listed below is still valid and should still be considered. I will update this document once all content has been moved.