Skip to content

Instantly share code, notes, and snippets.

<?php
function do_auth() {
// prompt for password
header('WWW-Authenticate: Basic realm="pbrisbin dot com"');
header('HTTP/1.0 401 Unauthorized');
// if user cancels
header('Content-type: text/plain');
echo 'Not authorized.';
<?php require_once('path/to/authentication.php');
$valid_users = array( 'user1' => 'password1'
, 'user2' => 'password2'
);
authenticate($valid_users);
// rest of page logic...
import Dzen
import RssReader
--
-- this is it, the whole application in one line!
--
main :: IO ()
main = spawnDzen dzenConf >>= spawnReader readerConf
myScratchPads = [ NS "mixer" spawnMixer findMixer manageMixer -- one scratchpad
, NS "terminal" spawnTerm findTerm manageTerm -- and a second
]
where
spawnMixer = "ossxmix" -- launch my mixer
findMixer = className =? "Ossxmix" -- its window has a ClassName of "Ossxmix"
manageMixer = customFloating $ W.RationalRect l t w h -- and I'd like it fixed using the geometry below:
myKeys = [ ...
, ...
, ("M4-t" , scratchTerm )
, ("M4-S-m" , scratchMixer)
, ...
]
where
myManageHook = ([ -- whatever it might be...
, ...
, ...
]) <+> namedScratchpadManageHook myScratchPads -- this manages the entire list of scratchpads
-- based on the query and hook listed for each
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="15dip" >
<TextView android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/label" />
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Raw Audio</string>
<string name="my_server">http://pbrisbin.com:8000/mpd.mp3</string>
<string name="label">Enter stream url:</string>
<string name="play_pause">Play/Pause</string>
</resources>
package rawAudio.apk;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
@Override public void onDestroy() {
// disconnect from our service
unbindService(onService);
super.onDestroy();
}