Skip to content

Instantly share code, notes, and snippets.


Huseyin Yilmaz huseyinyilmaz

View GitHub Profile

Memcached Protocol

  • There are 2 kinds of lines text (commands), unstructured data.
  • All lines ends with /r/n.
  • Keys are 250 characters. Keys must not include control characters or whitespace.


There are 3 kinds of commands.

  • Storage commands (there are six: “set”, “add”, “replace”, “append”, “prepend” and “cas”)
  • Retrieval commands (“get”, “gets”, “gat”, and “gats”)
  • All other commands don’t involve unstructured data.
  • Command names are lower-case and are case-sensitive.
huseyinyilmaz /
Created Nov 16, 2020
this file creates a sample log messages and sends them to /dev/log. I use this to test syslog config.
import logging
import logging.handlers
import time
my_logger = logging.getLogger('testlogger')
#add formatter to the handler
formatter = logging.Formatter(
'SAMPLE_CORE_KAMUSTA: { "loggerName":"%(name)s", "timestamp":"%(asctime)s", "pathName":"%(pathname)s", '
'"logRecordCreationTime":"%(created)f", "functionName":"%(funcName)s", "levelNo":"%(levelno)s", '
huseyinyilmaz /
Last active Jan 29, 2020
test server with hyper and tower server.
#![forbid(future_incompatible, rust_2018_idioms)]
#![deny(missing_debug_implementations, nonstandard_style)]
use std::task::{Context, Poll};
// use std::convert::Infallible;
use hyper::service::Service;
use hyper::{Body, Request, Response, Server};
fn iter_returner<'a>(names: Vec<&'a str>) -> impl Iterator<Item=String> + 'a {
let it = names.into_iter()
.map(|n| format!("hello {}", n))
fn main() {
Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded.
For example, the message '111' would give 3, since it could be decoded as 'aaa', 'ka', and 'ak'.
You can assume that the messages are decodable. For example, '001' is not allowed.
use std::collections::HashMap;
use std::rc;
huseyinyilmaz / main.hs
Created Apr 30, 2019
example monad transformer stack
View main.hs
-- | An example module.
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
module Example (main) where
import Control.Monad.Reader(ReaderT, runReaderT)
import Control.Monad.Reader(MonadReader)
import Control.Monad.Reader(MonadIO, liftIO)
import Control.Monad.Reader(ask)
View index.html
<div class="givva" data-uid="23179deb-2160-0f01-986d-c9cd54c163cd"></div>
View duplicates.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gmail_javascript_setup.js
(function injected(eventName, injectedIntoContentWindow)
let checkRequest;
* Frame context wrapper
* For some edge-cases Chrome will not run content scripts inside of frames.
* Website have started to abuse this fact to access unwrapped APIs via a
* frame's contentWindow (#4586, 5207). Therefore until Chrome runs content