Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@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:

@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
@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
-- | 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
@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:

@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---"
@supki
supki / pemis.sml
Created February 3, 2013 18:11
proglang week 3 tests
val t1 = only_capitals [] = []
val t2 = only_capitals ["hello", "bye"] = []
val t3 = only_capitals ["Anal", "hello", "bye"] = ["Anal"]
val t4 = only_capitals ["hello", "Pemis", "bye"] = ["Pemis"]
val t5 = only_capitals ["hello", "bye", "Eblo"] = ["Eblo"]
val t6 = longest_string1 [] = ""
val t7 = longest_string1 ["pemis"] = "pemis"
val t8 = longest_string1 ["pemis", "hello"] = "pemis"
val t9 = longest_string1 ["eblo", "hello"] = "hello"
@voidlizard
voidlizard / static-linked-ghc
Created December 3, 2012 12:53
Fully statically linked haskell application
ghc -i -static -optl-static -optl-pthread -funbox-strict-fields -fwarn-incomplete-patterns -isrc --make Program.hs
@TheEvilDev
TheEvilDev / Dependency.rb
Created November 27, 2012 00:31
Albacore improved nuspec generating, auto-dependency discovery
class Dependency
attr_accessor :Name, :Version
def initialize(name, version)
@Name = name
@Version = version
end
end
@copumpkin
copumpkin / Grothendieck.agda
Last active February 25, 2023 07:16
Grothendieck group
module Grothendieck where
open import Level using (_⊔_)
open import Function
open import Algebra
open import Algebra.Structures
open import Data.Product
import Relation.Binary.EqReasoning as EqReasoning