Skip to content

Instantly share code, notes, and snippets.

View donatello's full-sized avatar

Aditya Manthramurthy donatello

  • Bay Area, California
  • 06:42 (UTC -07:00)
View GitHub Profile
@donatello
donatello / client.py
Last active June 7, 2018 13:38
Gevent + Request Session object Thread Safety Test
import gevent
from gevent.monkey import patch_all
patch_all()
import requests
import json
s = requests.Session()
def make_request(s, d):
@donatello
donatello / lowstate output
Created April 1, 2014 08:16
Salt State Ordering from Top File - Bug 2
# salt-call state.show_lowstate
[INFO ] The `lspci` binary is not available on the system. GPU grains will not be available.
[WARNING ] Although 'dmidecode' was found in path, the current user cannot execute it. Grains output might not be accurate.
[INFO ] The `lspci` binary is not available on the system. GPU grains will not be available.
[WARNING ] Although 'dmidecode' was found in path, the current user cannot execute it. Grains output might not be accurate.
[INFO ] Loading fresh modules for state activity
local:
----------
- __env__:
base
@donatello
donatello / basepkgs.sls
Last active August 29, 2015 13:57
Salt State Ordering from Top File - Bug 1
#/srv/salt-state/basepkgs.sls
basepackages:
pkg.latest:
- pkgs:
- apt-transport-https
- bc
- debconf-utils
- emacs-goodies-el
- emacs23-nox
- htop
@donatello
donatello / prog.hs
Created November 18, 2012 10:33
GADTs to generate custom XML
{-# LANGUAGE GADTs #-}
import Text.XML.Light
mkElt :: String -> (Attributes, Body) -> Element
mkElt name (attribs, body) = Element {
elName = unqual name,
elAttribs = map (\(k, v) -> Attr (unqual k) v) attribs,
elContent = [Text (CData CDataRaw body Nothing)],
elLine = Nothing
@donatello
donatello / DivisorsHaskell.hs
Created August 21, 2012 10:38
Haskell implementations to find the divisors of a number
import Data.Int (Int64)
divisors :: Int64 -> [Int64]
divisors k = divisors' 2 k
where
divisors' n k | n*n > k = [k]
| n*n == k = [n, k]
| k `mod` n == 0 = (n:(k `div` n):result)
| otherwise = result
where result = divisors' (n+1) k