Skip to content

Instantly share code, notes, and snippets.

View sajith's full-sized avatar
😼
Why would I want to set a status on GitHub?

Sajith Sasidharan sajith

😼
Why would I want to set a status on GitHub?
View GitHub Profile
//
// pthread_t is usually an unsigned long, at least on Linux, but POSIX
// does not guarantee this.
//
#include <pthread.h>
#include <iostream>
int main()
{
Prelude> :load microlens-ex.hs
[1 of 1] Compiling Main ( microlens-ex.hs, interpreted )
microlens-ex.hs:17:5: error:
• No instance for (Data.String.IsString (Maybe Text))
arising from the literal ‘"true"’
• In the first argument of ‘(&)’, namely ‘"true"’
In the expression: "true" & _Bool .~ False
In an equation for ‘b’: b = "true" & _Bool .~ False
|
Prelude> :load microlens-ex.hs
[1 of 1] Compiling Main ( microlens-ex.hs, interpreted )
microlens-ex.hs:13:20: error:
• Variable not in scope:
(^?)
:: Text -> ((Integer -> f7 Integer) -> t10 -> f7 t10) -> Maybe Int
• Perhaps you meant one of these:
‘^’ (imported from Prelude), ‘^^’ (imported from Prelude)
|
#! /bin/bash
openssl pkcs12 -in usercred.p12 -nokeys -out usercert.pem
openssl pkcs12 -in usercred.p12 -nocerts -out userkey-with-pass.pem
openssl rsa -in userkey-with-pass.pem -out userkey.pem
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "@
escape ^jj
#! /bin/bash
# Stick this in ~/.bashrc or ~/.bash_profile:
if [ ! -S ~/.ssh/ssh_auth_sock ]; then
eval $(ssh-agent -s)
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
fi
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
ssh-add -l > /dev/null || ssh-add
:set prompt "λ » "
:def h \x -> return $ ":!hoogle -n 15 \"" ++ x ++ "\""
:def hoogle \x -> return $ ":!hoogle -n 15 \"" ++ x ++ "\""
:def doc \x -> return $ ":!hoogle --info \"" ++ x ++ "\""
:def hlint \x -> return $ ":!hlint \"" ++ x ++ "\""
:def package \m -> return $ ":!ghc-pkg --simple-output find-module " ++ m
:set prompt "λ » "
:def h \x -> return $ ":!hoogle -c -n 15 \"" ++ x ++ "\""
:def hoogle \x -> return $ ":!hoogle -c -n 15 \"" ++ x ++ "\""
:def doc \x -> return $ ":!hoogle --info \"" ++ x ++ "\""
:def hlint \x -> return $ ":!hlint \"" ++ x ++ "\""
:def browser \ u -> return $ ":!firefox " ++ u
#include <iostream>
#include <stdexcept>
// Constructing a string from a null pointer appears to be undefined
// behaviour. With GCC 4.8.5, attempting to do so results in a
// std::logic_error exception.
int main(int argc, char *argv[])
{
try
#include <iostream>
#include <string.h>
#include <sys/statvfs.h>
/*
* How do we find disk usage? You know, the way "df" does? we can
* use statvfs() or statfs() calls! The former is moar standard and
* POSIX-ey, the latter is BSD-ism that Linux happens to have
* implemented.
*