Skip to content

Instantly share code, notes, and snippets.

Oleku Konko olekukonko

View GitHub Profile
View bank.go
// Copyright 2016 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@olekukonko
olekukonko / tx.go
Created Sep 17, 2017 — forked from lyoshenka/tx.go
A simple, neat way to wrap code in an sql transaction with proper committing/rollbacking and error handling.
View tx.go
// TxFunc is a function that can be wrapped in a transaction
type TxFunc func(tx *sql.Tx) error
// WithTx wraps a function in an sql transaction. After the function returns, the transaction is
// committed if there's no error, or rolled back if there is one.
func WithTx(db *sql.DB, f TxFunc) (err error) {
tx, err := db.Begin()
if err != nil {
return err
}
@olekukonko
olekukonko / trust.go
Created Sep 8, 2017
Trusting Local Certificate
View trust.go
package main
import (
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@olekukonko
olekukonko / reclaimWindows10.ps1
Created Jan 18, 2017 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
View reclaimWindows10.ps1
##########
# Win10 Initial Setup Script
# Author: Disassembler <disassembler@dasm.cz>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
@olekukonko
olekukonko / golang-tls.md
Created Jan 1, 2017 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
View golang-tls.md
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@olekukonko
olekukonko / preprocessor_fun.h
Last active Aug 30, 2015 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
View preprocessor_fun.h
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
View Tags.go
package main
import (
"fmt"
"reflect"
"net/url"
)
type ExampleType struct {
Name string `url:"name"`
View bytesreader.go
func handleUpload(u io.Reader) (err error) {
// capture all bytes from upload
b, err := ioutil.ReadAll(u)
if err != nil {
return
}
// wrap the bytes in a ReadSeeker
r := bytes.NewReader(b)
View Animated-Background.markdown
You can’t perform that action at this time.