Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@sean-horn
sean-horn / gist:4732213
Created February 7, 2013 16:37
Example cookbook Ruby code to show all versions of all cookbooks for the _default env
log "---writing all ckbks and version---"
require 'rest_client'
env = "_default"
num_versions = "num_versions=all"
api_endpoint = env ? "/environments/#{env}/cookbooks?#{num_versions}" : "/cookbooks?#{num_versions}"
r = Chef::REST.new(Chef::Config[:chef_server_url])
cookbook_versions = r.get_rest(api_endpoint)
log "#{cookbook_versions}"
log "---End writing all ckbks and version---"
@davefp
davefp / LICENSE.md
Last active April 1, 2021 04:30
Weather Widget for Dashing

The MIT License (MIT)

Copyright (c) 2014 David Underwood

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

-- | Look for player state changes over time
candidate :: Wire Error Y.MPD Int64 Change
candidate = mkStateM NotPlaying $ \_dt (t, s) ->
Y.stState `fmap` Y.status >>= \s' -> case (s, s') of
-- If we were not playing and are not playing now there is no candidate to send
(NotPlaying, Y.Stopped) -> return (Left NoCandidate, NotPlaying)
(NotPlaying, Y.Paused) -> return (Left NoCandidate, NotPlaying)
-- If we started playing just now there is a candidate to send
(NotPlaying, Y.Playing) -> do
Just song <- Y.currentSong
@twanvl
twanvl / Sorting.agda
Last active December 2, 2022 16:44
Correctness and runtime of mergesort, insertion sort and selection sort.
module Sorting where
-- See https://www.twanvl.nl/blog/agda/sorting
open import Level using () renaming (zero to ℓ₀;_⊔_ to lmax)
open import Data.List hiding (merge)
open import Data.List.Properties
open import Data.Nat hiding (_≟_;_≤?_)
open import Data.Nat.Properties hiding (_≟_;_≤?_;≤-refl;≤-trans)
open import Data.Nat.Logarithm
open import Data.Nat.Induction
@saamalik
saamalik / .tmux.conf
Last active April 12, 2016 16:06
My Tmux configuration
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
#setting the delay between prefix and command
set -s escape-time 4
# Rest the cursor back to input mode
@kputnam
kputnam / dtruss-vim-write.md
Created July 11, 2013 05:53
Vim system calls when saving a file

Using dtruss on vim's :w

Ever wonder what happens when you save a file in vim? There's quite a lot more happening than open, write, and close. I found this out while working on some code to monitor changed files using the node.js fs.watch API, which abstracts (or obscures) Mac OS X's kqueue API.

To find out exactly what vim is doing when saving a file, we'll use a tool included with DTrace that reports on another process's system calls. We need the process ID of vim, which is already open and editing my file:

@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

anonymous
anonymous / Haskell
Created October 7, 2013 19:22
Comparison of the straightforward embedding of a basic tenet of category theory in Scala vs Haskell.
yonedaLemma = Iso (flip fmap) ($ id)
@akimboyko
akimboyko / Nat.fs
Created October 17, 2013 05:47
Quiz from Functional Programming Principles in Scala by Martin Odersky, lecture 4.2 implemented on F# with unittests
//Provide an implementation of the abstract class Nat that represents non-negative integers
//
//Do not use standard numerical classes in this implementation.
//Rather, implement a sub-object and sub-class:
//
//class Zero : Nat
//class Succ(n: Nat) : Nat
//
//One of the number zero, then other for strictly positive numbers.
namespace Nat
@mxswd
mxswd / Monad.cc
Last active December 28, 2015 07:49
#include <tr1/type_traits>
#include <iostream>
#include <vector>
#include <algorithm>
// (* -> *) -> Constraint
template<template <typename> class T>
class Functor {
public:
template <typename A, typename B>