Skip to content

Instantly share code, notes, and snippets.

View kirugan's full-sized avatar
:atom:
Creating awesomeness

Kirill kirugan

:atom:
Creating awesomeness
View GitHub Profile
@kirugan
kirugan / simple_increment_failure.go
Last active February 21, 2018 16:37
Example of non atomic ++
package main
import (
"fmt"
"time"
"sync"
)
var glob int64 = 0
var mu sync.Mutex
@kirugan
kirugan / main.c
Created July 28, 2018 17:44
activation record test
#include <stdio.h>
/**
* channeling "feature" in activation record
*/
void DeclareAndInitArray() {
int array[100];
int j;
int i;
@kirugan
kirugan / test.go
Created December 12, 2018 14:08
Panic goroutine test
package main
import (
"fmt"
"runtime"
"syscall"
"time"
)
func main() {
@kirugan
kirugan / test.java
Created December 12, 2018 14:33
Test java exception in multithread env
class Test {
public static void main(String args[]) throws InterruptedException {
Thread t = new Thread() {
public void run() {
System.out.println("Welcome new thread");
throw new RuntimeException("Hey there!");
}
};
@kirugan
kirugan / context_test.go
Created February 5, 2019 20:54
Test http.Shutdown and request.Context
package main
import (
"context"
"fmt"
"net/http"
"time"
)
func main() {
@kirugan
kirugan / condition_test.go
Created February 8, 2019 10:42
sync.Cond demonstration
package main
import (
"fmt"
"sync"
"time"
)
func main() {
nConnections := 10
@kirugan
kirugan / redis_client.go
Created March 1, 2019 17:41
debug pool
package main
import (
"context"
"fmt"
"github.com/gomodule/redigo/redis"
"sync"
"sync/atomic"
"time"
)
@kirugan
kirugan / infinite.go
Created March 20, 2019 21:15
Go scheduler design migh lead your code to freeze
package main
import (
"fmt"
"runtime"
"sync"
"time"
)
func main() {
@kirugan
kirugan / failure_rate.go
Created June 7, 2019 13:25
Simple script that allows you to get experience with failure rate
package main
import (
"fmt"
"math/rand"
"time"
)
func init() {
rand.Seed(time.Now().UnixNano())
@kirugan
kirugan / competition.cpp
Last active October 11, 2020 20:39
Template for competitive programming
#include <bits/stdc++.h>
using namespace std;
#define ALL(X) begin(X), end(X)
int main() {
// solution comes here
}