Content moved.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Original author: Vikraman (vh4x0r @ Freenode) <vikraman.choudhury@gmail.com> */ | |
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <netdb.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
amixer_() { | |
# Workaround | |
amixer -c 0 sset Headphone unmute | |
amixer -c 0 sset Speaker unmute | |
amixer "$@" | |
} | |
notify() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
amixer_() { | |
# Workaround | |
amixer -c 0 sset Headphone unmute | |
amixer -c 0 sset Speaker unmute | |
amixer "$@" | |
} | |
notify() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Connect to a server | |
redis-cli server | |
# Make an insert | |
set key value | |
# Make multiple insert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stack | |
-- stack script --resolver lts-10.8 | |
-- vim: ft=haskell | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GHC 7.8.3 (base-4.7.0.1): lts-0.0 -> lts-0.7 | |
GHC 7.8.4 (base-4.7.0.2): lts-1.0 -> lts-2.22 | |
GHC 7.10.2 (base-4.8.1.0): lts-3.0 -> lts-3.22 | |
GHC 7.10.3 (base-4.8.2.0): lts-4.0 -> lts-6.35 | |
GHC 8.0.1 (base-4.9.0.0): lts-7.0 -> lts-7.24 | |
GHC 8.0.2 (base-4.9.1.0): lts-8.0 -> lts-9.21 | |
GHC 8.2.2 (base-4.10.1.0): lts-10.0 -> lts-10.3 |
I want to automate monitor switching with a shell script.
The following is the output of the xrandr
command on my laptop:
Screen 0: minimum 320 x 200, current 4160 x 1600, maximum 32767 x 32767
LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
1600x900 60.0*+ 40.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stack | |
{- | |
stack | |
--resolver lts-8.11 | |
--install-ghc | |
runghc | |
--package aeson | |
--package filepath | |
--package http-client-tls | |
-- -Wall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Yielder | |
attr_reader :element | |
def initialize | |
# #yield will block until some other thread calls #next | |
@blocked = true | |
# #next will block until some other thread calls #yield | |
@yielded = false |