/**
sample javascript from xui
*/varundefined,xui,window=this,string=newString('string'),document=window.document,simpleExpr=/^#?([\w-]+)$/,idExpr=/^#/,tagExpr=/<([\w:]+)/,slice=function (e){return[].slice.call(e,0);};try{vara=slice(document.documentElement.childNodes)[0].nodeType;}catch(e){slice=function (e){varret=[];for (vari=0;e[i];i++)ret.push(e[i]);returnret;};}window.x$=window.xui=xui=function(q,context){returnnewxui.fn.find(q,context);};
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>A Tiny Page</title><style type="text/css"><!--p{font-size:15pt;color:#000}--></style></head><!-- real comment --><bodybgcolor="#FFFFFF"text="#000000"link="#0000CC"><script language="javascript"type="text/javascript">functionchangeHeight(h){vartds=document.getElementsByTagName("td");for(vari=0;i<tds.length;i++){tds[i].setAttribute("height",h+"px");}}</script><h1>abc</h1><h2>def</h2><p>Testing page</p></body></html>
#import "Cocoa1AppDelegate.h"
@implementationCocoa1AppDelegate@synthesizewindow,siteUrl,pageContents;-(void)applicationDidFinishLaunching:(NSNotification*)aNotification{// Insert code here to initialize your applicationmodel=[[Cocoa1Modelalloc]init];}-(IBAction)getSiteContents:(id)sender{[modelsetPageUrl:[siteUrlstringValue]];NSString*reply=[modelgetUrlAsString];NSLog(@"pageSrc: %@",reply);[pageContentssetString:reply];[[[pageContentstextStorage]mutableString]appendString:reply];}@end
{-# LANGUAGE OverloadedStrings #-}moduleMainwhere--import Prelude hiding (id)--import Control.Category (id)importControl.Arrow((>>>),(***),arr)importControl.Monad(forM_)-- import Data.Monoid (mempty, mconcat)-- import System.FilePathimportHakyllmain::IO()main=hakyll$doroute"css/*"$setExtension"css"compile"css/*"$byExtension(error"Not a (S)CSS file")[(".css",compressCssCompiler),(".scss",sass)]route"js/**"idRoutecompile"js/**"copyFileCompilerroute"img/*"idRoutecompile"img/*"copyFileCompilercompile"templates/*"templateCompilerforM_["test.md","index.md"]$\page->doroutepage$setExtension"html"compilepage$pageCompiler>>>applyTemplateCompiler"templates/default.html">>>relativizeUrlsCompilersass::CompilerResourceStringsass=getResourceString>>>unixFilter"sass"["-s","--scss"]>>>arrcompressCss
#!/bin/bashcd$ROOT_DIRDOT_FILES="lastpass weechat ssh Xauthority"for dotfile in$DOT_FILES;do conform_link "$DATA_DIR/$dotfile"".$dotfile";done# TODO: refactor with suffix variables (or common cron values)case"$PLATFORM"in
linux)#conform_link "$CONF_DIR/shell/zshenv" ".zshenv"
crontab -l>$ROOT_DIR/tmp/crontab-conflict-arch
cd$ROOT_DIR/$CONF_DIR/cron
if[["$(diff ~/tmp/crontab-conflict-arch crontab-current-arch)"==""]];then# no difference with current backup
logger "$LOG_PREFIX: crontab live settings match stored "\"settings; no restore required"rm ~/tmp/crontab-conflict-arch
else# current crontab settings in file do not match live settings
crontab $ROOT_DIR/$CONF_DIR/cron/crontab-current-arch
logger "$LOG_PREFIX: crontab stored settings conflict with "\"live settings; stored settings restored. "\"Previous settings recorded in ~/tmp/crontab-conflict-arch."fi;;
# test python (sample from offlineimap)
classExitNotifyThread(Thread):"""This class is designed to alert a "monitor" to the fact that a thread has
exited and to provide for the ability for it to find out why."""defrun(self):globalexitthreads,profiledirself.threadid=thread.get_ident()try:ifnotprofiledir:# normal case
Thread.run(self)else:try:importcProfileasprofileexceptImportError:importprofileprof=profile.Profile()try:prof=prof.runctx("Thread.run(self)",globals(),locals())exceptSystemExit:passprof.dump_stats( \
profiledir+"/"+str(self.threadid)+"_"+ \
self.getName()+".prof")except:self.setExitCause('EXCEPTION')ifsys:self.setExitException(sys.exc_info()[1])tb=traceback.format_exc()self.setExitStackTrace(tb)else:self.setExitCause('NORMAL')ifnothasattr(self,'exitmessage'):self.setExitMessage(None)ifexitthreads:exitthreads.put(self,True)defsetExitCause(self,cause):self.exitcause=causedefgetExitCause(self):"""Returns the cause of the exit, one of:
'EXCEPTION' -- the thread aborted because of an exception
'NORMAL' -- normal termination."""returnself.exitcausedefsetExitException(self,exc):self.exitexception=excdefgetExitException(self):"""If getExitCause() is 'EXCEPTION', holds the value from
sys.exc_info()[1] for this exception."""returnself.exitexceptiondefsetExitStackTrace(self,st):self.exitstacktrace=stdefgetExitStackTrace(self):"""If getExitCause() is 'EXCEPTION', returns a string representing
the stack trace for this exception."""returnself.exitstacktracedefsetExitMessage(self,msg):"""Sets the exit message to be fetched by a subsequent call to
getExitMessage. This message may be any object or type except
None."""self.exitmessage=msgdefgetExitMessage(self):"""For any exit cause, returns the message previously set by
a call to setExitMessage(), or None if there was no such message
set."""returnself.exitmessage
#!perl -w# Time-stamp: <2002/04/06, 13:12:13 (EST), maverick, csvformat.pl># Two pass CSV file to table formatter$delim=$#ARGV>=1?$ARGV[1]:',';printSTDERR"Split pattern: $delim\n";# first passopenF,"<$ARGV[0]"ordie;while(<F>){chomp;$i=0;map{$max[$_->[1]]=$_->[0]if$_->[0]>($max[$_->[1]]||0)}(map{[length$_,$i++]}split($delim));}closeF;printSTDERR'Field width: ',join(', ',@max),"\n";printSTDERRjoin('',map{'-'x$_}@max);# second passopenF,"<$ARGV[0]"ordie;while(<F>){chomp;$i=0;map{printf("%-$max[$_->[1]]s ",$_->[0])}(map{[$_,$i++]}split($delim));print"\n";}closeF;
importjava.util.Map;importjava.util.TreeSet;publicclassGetEnv{/**
* let's test generics
* @param args the command line arguments
*/publicstaticvoidmain(String[]args){// get a map of environment variablesMap<String,String>env=System.getenv();// build a sorted set out of the keys and iteratefor(Stringk:newTreeSet<String>(env.keySet())){System.out.printf("%s = %s\n",k,env.get(k));}}}
#define UNICODE
#include<windows.h>intmain(intargc,char**argv){intspeed=0,speed1=0,speed2=0;// 1-20printf("Set Mouse Speed by Maverick\n");SystemParametersInfo(SPI_GETMOUSESPEED,0,&speed,0);printf("Current speed: %2d\n",speed);if(argc==1)return0;if(argc>=2)sscanf(argv[1],"%d",&speed1);if(argc>=3)sscanf(argv[2],"%d",&speed2);if(argc==2)// set speed to first valuespeed=speed1;elseif(speed==speed1||speed==speed2)// alternatespeed=speed1+speed2-speed;elsespeed=speed1;// start with first valueSystemParametersInfo(SPI_SETMOUSESPEED,0,speed,0);SystemParametersInfo(SPI_GETMOUSESPEED,0,&speed,0);printf("New speed: %2d\n",speed);return0;}
# Given an alphabet:alphabet='abcdefghijklmnopqrstuvwxyz'# Iterate over part of the alphabet:console.logletterforinalphabet[4..8]