Skip to content

Instantly share code, notes, and snippets.

@pbrisbin
pbrisbin / scanner.c
Created June 26, 2011 00:26
simple port scanner
/* 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>
#!/bin/sh
amixer_() {
# Workaround
amixer -c 0 sset Headphone unmute
amixer -c 0 sset Speaker unmute
amixer "$@"
}
notify() {
@pbrisbin
pbrisbin / setup.md
Last active March 19, 2019 15:39
Arch installation notes
#!/bin/sh
amixer_() {
# Workaround
amixer -c 0 sset Headphone unmute
amixer -c 0 sset Speaker unmute
amixer "$@"
}
notify() {
@pbrisbin
pbrisbin / redis.sh
Created October 20, 2014 14:34
Redis cheat-sheet (gist mirror of something on pastebin.com)
# Connect to a server
redis-cli server
# Make an insert
set key value
# Make multiple insert
@pbrisbin
pbrisbin / a-persistent.hs
Last active July 3, 2018 18:50
Persistent problems in LTS-11.15+
#!/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 #-}
@pbrisbin
pbrisbin / 1-output.txt
Last active January 23, 2018 18:48
LTS resolvers by GHC version
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
@pbrisbin
pbrisbin / vmode.md
Last active October 10, 2017 06:34
A very extended shell scripting example, using Sed, Awk, and Bash

I want to automate monitor switching with a shell script.

The Plan

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 
#!/usr/bin/env stack
{-
stack
--resolver lts-8.11
--install-ghc
runghc
--package aeson
--package filepath
--package http-client-tls
-- -Wall
#!/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