Skip to content

Instantly share code, notes, and snippets.

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

Aleksandr Tihomirov zet4

🏠
Working from home
View GitHub Profile
@zet4
zet4 / sanitize.cpp
Last active October 22, 2015 07:50
Sanitize with Templates and Callbacks.
#include <iostream>
#include <string>
namespace utils {
template< typename ParamType, typename Functor >
ParamType sanitize(Functor callback, std::string entryMessage) {
ParamType temp;
do {
std::cout << entryMessage;
} while(!(std::cin >> temp) || !callback(temp));
@zet4
zet4 / IoC.py
Created October 27, 2015 07:30
Inversion of Control in Python (DI)
import os
class FeatureBroker:
def __init__(self, allowReplace=False):
self.providers = {}
self.allowReplace = allowReplace
def Provide(self, feature, provider, *args, **kwargs):
if not self.allowReplace:
@zet4
zet4 / games.json
Created October 28, 2015 16:41
Discord Games.json 10/28/2015
[
{
"executables": {
"win32": [
"pol.exe"
]
},
"id": 0,
"name": "FINAL FANTASY XI"
},
@zet4
zet4 / main.go
Created January 20, 2016 09:41 — forked from segphault/main.go
An IRC bot written in Go that provides notification when a RethinkDB cluster experiences issues
package main
import (
"code.google.com/p/gcfg"
"fmt"
r "github.com/dancannon/gorethink"
irc "github.com/fluffle/goirc/client"
"log"
"strings"
)
@zet4
zet4 / desktop.boxstarter
Created January 23, 2016 13:21 — forked from lepinkainen/desktop.boxstarter
Boxstarter script
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
# Development
cinst -y powershell
cinst -y githubforwindows
cinst -y python3
cinst -y git.commandline
cinst -y sublimetext3
# Media
@zet4
zet4 / carbon.zsh-theme
Created March 8, 2016 09:21
My version of kardan theme.
# My version of kardan theme.
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
function get_host {
echo '@'$HOST
}
function get_user {
echo "%{$fg[$NCOLOR]%}(as "`who am i | sed -e 's/ .*//'`")%{$reset_color%}"
@zet4
zet4 / preprocessor_fun.h
Created April 21, 2016 09:38 — forked from aras-p/preprocessor_fun.h
Things to commit just before leaving your job
// 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,

Keybase proof

I hereby claim:

  • I am zetahunter on github.
  • I am zeta (https://keybase.io/zeta) on keybase.
  • I have a public key whose fingerprint is 1695 776B 5BA4 B2BF 43D0 8004 7392 9363 1F30 18CB

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am zet4 on github.
  • I am zeta (https://keybase.io/zeta) on keybase.
  • I have a public key whose fingerprint is 1695 776B 5BA4 B2BF 43D0 8004 7392 9363 1F30 18CB

To claim this, I am signing this object:

@zet4
zet4 / sse.go
Created December 5, 2016 19:03 — forked from schmohlio/sse.go
Example SSE server in Golang
// v2 of the great example of SSE in go by @ismasan.
// includes fixes:
// * infinite loop ending in panic
// * closing a client twice
// * potentially blocked listen() from closing a connection during multiplex step.
package main
import (
"fmt"
"log"