Skip to content

Instantly share code, notes, and snippets.

@Israel-Miles
Israel-Miles / main.go
Created April 5, 2021 21:11
full blockchain
package main
import (
"crypto/sha256"
"fmt"
"time"
)
type Block struct {
timestamp time.Time
@cicanci
cicanci / main.cpp
Last active March 1, 2023 12:45
Hello World with SDL2
#include <SDL.h>
// Window size
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
// Image size
#define IMAGE_WIDTH 256
#define IMAGE_HEIGHT 256
package main
import (
"fmt"
"log"
"time"
"github.com/gomodule/redigo/redis"
)
@sohamkamani
sohamkamani / rsa.go
Created April 12, 2020 17:31
Example of RSA encryption, decryption, signing, and verification in Go
package main
import (
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
"encoding/base64"
"fmt"
)
//
// main.cpp
// NeuralNetwork
//
// Created by Santiago Becerra on 9/15/19.
// Copyright © 2019 Santiago Becerra. All rights reserved.
//
//
#include <iostream>
@kassane
kassane / Event_Loop.md
Created April 6, 2019 14:26
Explain Event Loop

Event Loop

In computer science, the event loop, message dispatcher, message loop, message pump, or run loop is a programming construct that waits for and dispatches events or messages in a program.

It works by making a request to some internal or external "event provider" (that generally blocks the request until an event has arrived), and then it calls the relevant event handler ("dispatches the event").

The event-loop may be used in conjunction with a reactor, if the event provider follows the file interface, which can be selected or 'polled' (the Unix system call, not actual polling).

The event loop almost always operates asynchronously with the message originator.

@thiagozs
thiagozs / gomock.md
Last active July 3, 2024 14:59
Tutorial gomock

08/16/17 by  Sergey Grebenshchikov

No Comments

This is a quick tutorial on how to test code using the GoMock mocking library and the standard library testing package testing.

GoMock is a mock framework for Go. It enjoys a somewhat official status as part of the github.com/golang organization, integrates well with the built-in testing package, and provides a flexible expectation API.

@miguelmota
miguelmota / pubsub.go
Created October 6, 2018 21:12
Golang redis pub/sub example
package pubsub
import (
"github.com/garyburd/redigo/redis"
log "github.com/sirupsen/logrus"
)
// Service service
type Service struct {
pool *redis.Pool
@debnath
debnath / gist:e11de2e10ec36055eda9e446b536874e
Last active June 4, 2024 18:42
Example usage of sync.Map: Store(), Load() and Range()
package main
import (
"fmt"
"sync"
)
func main() {
var wg sync.WaitGroup
var m sync.Map
@ximik777
ximik777 / print_tree.c
Last active April 27, 2024 05:31
Printing Binary Trees in Ascii
/*
Copy from: http://web.archive.org/web/20090617110918/http://www.openasthra.com/c-tidbits/printing-binary-trees-in-ascii/
Source: http://web.archive.org/web/20071224095835/http://www.openasthra.com:80/wp-content/uploads/2007/12/binary_trees1.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>