├── cpp ├── #binary.cpp# ├── test.c ├── double.c ├── brk.c ├── whileone.cc ├── boost │ ├── BUILD │ ├── scoped_test.cc │ ├── simple.cc │ ├── tags │ ├── bind.cc │ └── unittest.cc ├── istream.cc ├── cin.cc ├── container.cc ├── interview.cpp ├── casting.cc └── casting_virtual.cc ├── haskell ├── binaryfile ├── file.txt ├── wc.hs ├── PCRESubTest.hs ├── maybe.hs ├── list.hs ├── regsub.hs ├── powerset.hs ├── hello.hs ├── TokenBucketTest.hs ├── join.hs ├── readert.hs ├── fold.hs ├── unwrapio.hs ├── vector.hs ├── io.hs ├── suffixes.hs ├── debugging.hs ├── t1.hs ├── file.hs ├── stmonad.hs ├── chan.hs ├── avg.hs ├── mvar.hs ├── readline.hs ├── concat.hs ├── pardata.hs ├── xmlrep.hs ├── splitlines.hs ├── elf.hs ├── interact.hs ├── binary.hs ├── factrec.hs ├── euler1.hs ├── random.hs ├── PNM.hs ├── euler7.hs ├── typeclass.hs ├── quicksort.hs ├── euler10.hs ├── LineServerTest.hs ├── renamer.hs ├── unlines.hs ├── min.hs ├── Test.hs ├── picture.hs ├── euler2.hs ├── logger.hs ├── First.hs ├── http.hs ├── max.hs ├── euler3.hs ├── hexdump.hs ├── udpserver.hs └── homework2.hs ├── latex ├── hello.aux ├── hello.dvi ├── hello1.png └── hello.tex ├── rust ├── .gitignore ├── hello │ ├── .gitignore │ ├── src │ │ ├── tuples.rs │ │ ├── types.rs │ │ ├── vars.rs │ │ ├── functions.rs │ │ ├── generics.rs │ │ ├── print.rs │ │ ├── strings.rs │ │ ├── args.rs │ │ ├── threadpool.rs │ │ ├── pointers.rs │ │ ├── structs.rs │ │ ├── lifetimes.rs │ │ ├── dynamic.rs │ │ ├── asyncawait.rs │ │ └── iterators.rs │ ├── Cargo.toml │ └── README.md ├── leetcode │ ├── src │ │ ├── string_to_integer_atoi.rs │ │ └── lib.rs │ ├── Cargo.lock │ └── Cargo.toml ├── btree │ ├── Cargo.lock │ └── Cargo.toml ├── stack │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── stack.rs ├── hype │ ├── src │ │ ├── main.rs │ │ ├── lib.rs │ │ └── status.rs │ └── Cargo.toml ├── threads │ ├── Cargo.toml │ └── src │ │ └── main.rs └── echo │ └── Cargo.toml ├── python ├── webapp │ ├── models │ │ ├── __init__.py │ │ ├── metadata.py │ │ └── api.py │ ├── vexweb │ │ └── __init__.py │ ├── static │ │ ├── marilyn.jpg │ │ ├── js │ │ │ ├── main.js │ │ │ └── user_api.js │ │ └── style.css │ ├── templates │ │ ├── frontpage.html │ │ └── base.html │ └── model_test.py ├── README ├── cartman.mp3 ├── marilyn.jpg ├── torchtest.py ├── system.py ├── colors.py ├── mp3renamer.py ├── tornado_test.py ├── challenges │ ├── house_robber.py │ ├── easy_div7_not5.py │ ├── fib.py │ ├── merge_intervals.py │ ├── max_subarray.py │ ├── trapping_water.py │ ├── minimum_window_substring.py │ └── max_profit.py ├── pigame.py ├── curses_test.py ├── readline_test.py ├── hellomac.py ├── permute.py ├── permwords.py ├── ml │ └── recommendations.py ├── combwords.py └── webpinger.py ├── kernel ├── Makefile ├── build.sh ├── hello.ko ├── hello.o ├── hello.mod.o ├── .tmp_versions │ └── hello.mod ├── .hello.ko.cmd ├── hello.c └── hello.mod.c ├── minikube ├── .gitignore ├── tls │ ├── .gitignore │ ├── ca.json │ ├── intermediate-ca.json │ └── ingress_host.json ├── helm │ ├── minikube.yaml │ ├── dice │ │ ├── .helmignore │ │ ├── values.yaml │ │ ├── templates │ │ │ ├── ingress.yaml │ │ │ ├── server-depl.yaml │ │ │ ├── main-depl.yaml │ │ │ └── envoy-depl.yaml │ │ └── Chart.yaml │ └── k3s.yaml ├── dice │ └── dice.proto ├── client │ └── cmd │ │ └── main.go ├── server.Dockerfile ├── server.arm64.Dockerfile ├── main.Dockerfile └── main.arm64.Dockerfile ├── scala ├── hello.rb ├── script.scala ├── NetBeansProjects │ └── AsteriskClient │ │ ├── nbproject │ │ ├── private │ │ │ ├── config.properties │ │ │ ├── private.properties │ │ │ └── private.xml │ │ ├── genfiles.properties │ │ └── project.xml │ │ ├── manifest.mf │ │ ├── dist │ │ └── AsteriskClient.jar │ │ ├── AMIConnection.scala │ │ └── src │ │ └── asteriskclient │ │ └── Main.scala ├── AsteriskClient │ ├── README │ ├── TestCall.scala │ └── Client.scala ├── HelloWorld.scala ├── ForEach.scala ├── Args.scala ├── Privacy.scala ├── MapTest.scala ├── Timer.scala ├── JettyHello.scala ├── README └── YamlReader.scala ├── emdr ├── .gitignore ├── README.md ├── tsconfig.json ├── .eslintrc ├── src │ ├── logger.ts │ └── index.ts ├── webpack.config.js ├── package.json └── index.html ├── ocaml ├── comment.ml ├── README └── average.ml ├── stats ├── tstf │ ├── .eslintignore │ ├── tailwind.config.js │ ├── .babelrc │ ├── postcss.config.js │ ├── stylelint.config.js │ └── .eslintrc.js ├── README.md └── hellotf.py ├── java ├── macbundle │ └── GlassDemo.app │ │ └── Contents │ │ ├── PkgInfo │ │ ├── MacOS │ │ └── JavaApplicationStub │ │ ├── Resources │ │ └── GenericJavaApp.icns │ │ └── Info.plist ├── quiz.data ├── EasyChatServer.java ├── model.xml ├── .DS_Store ├── xmpp │ ├── run.sh │ ├── lib │ │ ├── smack.jar │ │ ├── smackx.jar │ │ ├── smackx-debug.jar │ │ └── smackx-jingle.jar │ ├── Makefile │ └── SmackTest.java ├── j3d │ ├── Loader3D │ │ ├── icons │ │ │ ├── in.gif │ │ │ ├── up.gif │ │ │ ├── down.gif │ │ │ ├── left.gif │ │ │ ├── out.gif │ │ │ └── right.gif │ │ ├── models │ │ │ ├── CoolroboCoords.txt │ │ │ ├── bldg4Coords.txt │ │ │ ├── AARAM.3DS │ │ │ ├── CASTLE.COB │ │ │ ├── MAA-1.3DS │ │ │ ├── bldg4.3ds │ │ │ ├── COOLROBO.3DS │ │ │ ├── CastleCoords.txt │ │ │ ├── houseCoords.txt │ │ │ ├── BoxConeSphereCoords.txt │ │ │ └── AaramCoords.txt │ │ ├── Loader3D.bat │ │ └── compileLd.bat │ ├── LoaderInfo3D │ │ ├── portfolio.jar │ │ ├── models │ │ │ ├── AARAM.3DS │ │ │ ├── GUN1.3DS │ │ │ ├── MAA-1.3DS │ │ │ ├── stone.jpg │ │ │ ├── CASTLE.COB │ │ │ ├── column.3ds │ │ │ ├── COOLROBO.3DS │ │ │ └── dolphins.3ds │ │ ├── compileLI.bat │ │ ├── LoaderInfo3D.bat │ │ └── readme.txt │ ├── Random.java │ └── Checkers3D │ │ ├── Checkers3D.bat │ │ └── compileChk.bat ├── j2d │ └── mohit_muthanna_hindi.png ├── xmlrpc │ ├── xmlrpc-client-3.1.jar │ ├── xmlrpc-common-3.1.jar │ ├── xmlrpc-server-3.1.jar │ ├── commons-logging-1.1.jar │ ├── ws-commons-util-1.0.2.jar │ ├── run.sh │ └── XmlRpcClientTest.java ├── test.java ├── servlets │ ├── beer │ │ ├── nbproject │ │ │ └── private │ │ │ │ └── private.xml │ │ ├── web │ │ │ ├── beer.jsp │ │ │ └── beer.html │ │ ├── src │ │ │ └── com │ │ │ │ ├── model │ │ │ │ └── BeerExpert.java │ │ │ │ └── test │ │ │ │ ├── BeerListener.java │ │ │ │ └── BeerSelect.java │ │ └── etc │ │ │ └── web.xml │ └── first │ │ ├── etc │ │ └── web.xml │ │ └── src │ │ └── FirstServlet.java ├── DogTester.java ├── Dog.java ├── HelloWorld.java ├── WriteFile.java ├── PhraseOMatic.java ├── ImageDownloader.java ├── SearchMap.java └── AdviceGuy.java ├── www ├── mjk │ ├── mjk.jpg │ └── index.html ├── audio │ └── snare.wav ├── wavebox │ ├── audio │ │ └── track.mp3 │ ├── js │ │ └── remoteaudioplayer.js │ └── css │ │ └── style.css ├── tone │ └── css │ │ ├── le-frog │ │ └── images │ │ │ ├── ui-icons_4eb305_256x240.png │ │ │ ├── ui-icons_72b42d_256x240.png │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ ├── ui-bg_glass_55_fbf5d0_1x400.png │ │ │ ├── ui-bg_inset-soft_10_285c00_1x100.png │ │ │ ├── ui-bg_diagonals-small_0_aaaaaa_40x40.png │ │ │ ├── ui-bg_highlight-hard_30_285c00_1x100.png │ │ │ ├── ui-bg_highlight-soft_33_3a8104_1x100.png │ │ │ ├── ui-bg_highlight-soft_50_4eb305_1x100.png │ │ │ ├── ui-bg_highlight-soft_60_4ca20b_1x100.png │ │ │ ├── ui-bg_diagonals-thick_15_444444_40x40.png │ │ │ └── ui-bg_diagonals-thick_95_ffdc2e_40x40.png │ │ └── tone.css ├── analyzer │ └── css │ │ └── le-frog │ │ └── images │ │ ├── ui-icons_4eb305_256x240.png │ │ ├── ui-icons_72b42d_256x240.png │ │ ├── ui-icons_cd0a0a_256x240.png │ │ ├── ui-icons_ffffff_256x240.png │ │ ├── ui-bg_glass_55_fbf5d0_1x400.png │ │ ├── ui-bg_inset-soft_10_285c00_1x100.png │ │ ├── ui-bg_diagonals-small_0_aaaaaa_40x40.png │ │ ├── ui-bg_diagonals-thick_15_444444_40x40.png │ │ ├── ui-bg_diagonals-thick_95_ffdc2e_40x40.png │ │ ├── ui-bg_highlight-hard_30_285c00_1x100.png │ │ ├── ui-bg_highlight-soft_33_3a8104_1x100.png │ │ ├── ui-bg_highlight-soft_50_4eb305_1x100.png │ │ └── ui-bg_highlight-soft_60_4ca20b_1x100.png ├── README ├── jstest.html ├── something.html ├── draggable.html ├── style.css ├── index.html ├── maps.html ├── filter.html └── rubyrefresher │ └── refresher.css ├── js ├── glyphnames.js.gz ├── glyphnames2.js.gz ├── denolib.ts ├── v8 │ ├── SConstruct │ ├── README │ └── test.cc ├── deno_test.js ├── greasemonkey │ ├── helloworld.user.js │ ├── renamer.user.js │ └── yoogle.user.js ├── denorun.ts └── notify.js ├── perl ├── Lyndebrook.glf ├── printf.pl └── glf2csv ├── go ├── hello.go ├── empty.go ├── echo.go ├── parity.go └── wscript ├── android └── CounterService │ ├── bin │ ├── classes.dex │ ├── resources.ap_ │ └── CounterService.apk │ ├── res │ ├── drawable │ │ └── icon.png │ ├── layout │ │ ├── main.xml │ │ └── local_service_controller.xml │ └── values │ │ └── strings.xml │ ├── .classpath │ ├── default.properties │ └── .project ├── ruby ├── urlencode │ └── u.rb ├── push.sh ├── gencsv.rb ├── parsecsv.rb ├── midi │ └── README.md ├── nc.rb ├── wget.rb ├── README.md └── refresher.css ├── .gitignore ├── asm ├── old │ ├── Makefile │ ├── disasm.c │ ├── asm.S │ └── disasm.s ├── printf.asm ├── loop.asm ├── Makefile ├── hello64.asm ├── lib.asm └── sum.asm ├── opencv ├── SConstruct └── capture.cc ├── cs └── hellocoffee.html ├── asterisk ├── res_hello.c └── test_call.sh ├── octave └── timestretch.m ├── images └── cleanup.sh └── r └── waves.rscript /cpp/#binary.cpp#: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /haskell/binaryfile: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /latex/hello.aux: -------------------------------------------------------------------------------- 1 | \relax 2 | -------------------------------------------------------------------------------- /rust/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | -------------------------------------------------------------------------------- /python/webapp/models/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python/webapp/vexweb/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rust/hello/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /kernel/Makefile: -------------------------------------------------------------------------------- 1 | obj-m := hello.o 2 | -------------------------------------------------------------------------------- /minikube/.gitignore: -------------------------------------------------------------------------------- 1 | main 2 | tmp 3 | -------------------------------------------------------------------------------- /scala/hello.rb: -------------------------------------------------------------------------------- 1 | print "Hello Ruby" 2 | -------------------------------------------------------------------------------- /emdr/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /haskell/file.txt: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | -------------------------------------------------------------------------------- /minikube/tls/.gitignore: -------------------------------------------------------------------------------- 1 | *.pem 2 | *.csr 3 | -------------------------------------------------------------------------------- /ocaml/comment.ml: -------------------------------------------------------------------------------- 1 | (* some comment *) 2 | -------------------------------------------------------------------------------- /stats/tstf/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | -------------------------------------------------------------------------------- /java/macbundle/GlassDemo.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /ocaml/README: -------------------------------------------------------------------------------- 1 | Compiling OCaml 2 | 3 | $ ocamlc file.ml 4 | -------------------------------------------------------------------------------- /scala/script.scala: -------------------------------------------------------------------------------- 1 | println("Hello scriptish world") 2 | -------------------------------------------------------------------------------- /java/quiz.data: -------------------------------------------------------------------------------- 1 | Who are you?/Yo Mama 2 | Why are you?/Just Because 3 | -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/nbproject/private/config.properties: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /java/EasyChatServer.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.net.*; 3 | 4 | -------------------------------------------------------------------------------- /java/model.xml: -------------------------------------------------------------------------------- 1 | 2 | XML Sucks Balls 3 | 4 | -------------------------------------------------------------------------------- /kernel/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | make -C /usr/src/linux M=`pwd` modules 4 | -------------------------------------------------------------------------------- /python/README: -------------------------------------------------------------------------------- 1 | Get pyglet. 2 | 3 | For pygame: 4 | port install py-game 5 | -------------------------------------------------------------------------------- /java/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/.DS_Store -------------------------------------------------------------------------------- /kernel/hello.ko: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/kernel/hello.ko -------------------------------------------------------------------------------- /kernel/hello.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/kernel/hello.o -------------------------------------------------------------------------------- /latex/hello.dvi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/latex/hello.dvi -------------------------------------------------------------------------------- /www/mjk/mjk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/mjk/mjk.jpg -------------------------------------------------------------------------------- /kernel/hello.mod.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/kernel/hello.mod.o -------------------------------------------------------------------------------- /latex/hello1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/latex/hello1.png -------------------------------------------------------------------------------- /python/cartman.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/python/cartman.mp3 -------------------------------------------------------------------------------- /python/marilyn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/python/marilyn.jpg -------------------------------------------------------------------------------- /emdr/README.md: -------------------------------------------------------------------------------- 1 | # EMDR Remote 2 | 3 | ## Run 4 | 5 | ``` 6 | npm run develop 7 | ``` 8 | -------------------------------------------------------------------------------- /java/xmpp/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | java -cp lib/smack.jar:lib/smackx.jar:. SmackTest 4 | -------------------------------------------------------------------------------- /js/glyphnames.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/js/glyphnames.js.gz -------------------------------------------------------------------------------- /js/glyphnames2.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/js/glyphnames2.js.gz -------------------------------------------------------------------------------- /perl/Lyndebrook.glf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/perl/Lyndebrook.glf -------------------------------------------------------------------------------- /scala/AsteriskClient/README: -------------------------------------------------------------------------------- 1 | To run: 2 | 3 | $ scala asterisk.tools.TestCall 4 | 5 | 6 | -------------------------------------------------------------------------------- /www/audio/snare.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/audio/snare.wav -------------------------------------------------------------------------------- /java/xmpp/lib/smack.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmpp/lib/smack.jar -------------------------------------------------------------------------------- /js/denolib.ts: -------------------------------------------------------------------------------- 1 | export function add(a: number, b: number): number { 2 | return a + b; 3 | } 4 | -------------------------------------------------------------------------------- /java/xmpp/lib/smackx.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmpp/lib/smackx.jar -------------------------------------------------------------------------------- /python/webapp/models/metadata.py: -------------------------------------------------------------------------------- 1 | from sqlalchemy import MetaData 2 | 3 | metadata = MetaData() 4 | 5 | -------------------------------------------------------------------------------- /rust/leetcode/src/string_to_integer_atoi.rs: -------------------------------------------------------------------------------- 1 | // https://leetcode.com/problems/string-to-integer-atoi/ 2 | -------------------------------------------------------------------------------- /www/wavebox/audio/track.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/wavebox/audio/track.mp3 -------------------------------------------------------------------------------- /cpp/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main( int argc, char** argv ) { 4 | return asm_main(); 5 | } 6 | -------------------------------------------------------------------------------- /haskell/wc.hs: -------------------------------------------------------------------------------- 1 | main = interact wordCount 2 | where wordCount input = show (length (lines input)) ++ "\n" 3 | -------------------------------------------------------------------------------- /java/j3d/Loader3D/icons/in.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/icons/in.gif -------------------------------------------------------------------------------- /java/j3d/Loader3D/icons/up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/icons/up.gif -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/CoolroboCoords.txt: -------------------------------------------------------------------------------- 1 | Coolrobo.3ds 2 | -p 0 1.4 0 3 | -r 666666666 4 | -s 3.452 5 | -------------------------------------------------------------------------------- /java/xmpp/lib/smackx-debug.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmpp/lib/smackx-debug.jar -------------------------------------------------------------------------------- /kernel/.tmp_versions/hello.mod: -------------------------------------------------------------------------------- 1 | /home/mohit/work/test/linux/hello.ko 2 | /home/mohit/work/test/linux/hello.o 3 | -------------------------------------------------------------------------------- /go/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | fmt.Printf("hello, world\n"); 7 | } 8 | -------------------------------------------------------------------------------- /java/j2d/mohit_muthanna_hindi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j2d/mohit_muthanna_hindi.png -------------------------------------------------------------------------------- /java/j3d/Loader3D/icons/down.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/icons/down.gif -------------------------------------------------------------------------------- /java/j3d/Loader3D/icons/left.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/icons/left.gif -------------------------------------------------------------------------------- /java/j3d/Loader3D/icons/out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/icons/out.gif -------------------------------------------------------------------------------- /java/j3d/Loader3D/icons/right.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/icons/right.gif -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/bldg4Coords.txt: -------------------------------------------------------------------------------- 1 | bldg4.3ds 2 | -p 0 0.8 0 3 | -r 1122222222222221111111 4 | -s 4.177 5 | -------------------------------------------------------------------------------- /java/xmlrpc/xmlrpc-client-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmlrpc/xmlrpc-client-3.1.jar -------------------------------------------------------------------------------- /java/xmlrpc/xmlrpc-common-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmlrpc/xmlrpc-common-3.1.jar -------------------------------------------------------------------------------- /java/xmlrpc/xmlrpc-server-3.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmlrpc/xmlrpc-server-3.1.jar -------------------------------------------------------------------------------- /java/xmpp/lib/smackx-jingle.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmpp/lib/smackx-jingle.jar -------------------------------------------------------------------------------- /latex/hello.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \begin{document} 4 | 5 | Hello World! 6 | 7 | \end{document} 8 | -------------------------------------------------------------------------------- /python/webapp/static/marilyn.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/python/webapp/static/marilyn.jpg -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/AARAM.3DS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/models/AARAM.3DS -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/CASTLE.COB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/models/CASTLE.COB -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/MAA-1.3DS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/models/MAA-1.3DS -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/bldg4.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/models/bldg4.3ds -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/portfolio.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/portfolio.jar -------------------------------------------------------------------------------- /java/xmlrpc/commons-logging-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmlrpc/commons-logging-1.1.jar -------------------------------------------------------------------------------- /android/CounterService/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/android/CounterService/bin/classes.dex -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/COOLROBO.3DS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/Loader3D/models/COOLROBO.3DS -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/AARAM.3DS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/AARAM.3DS -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/GUN1.3DS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/GUN1.3DS -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/MAA-1.3DS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/MAA-1.3DS -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/stone.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/stone.jpg -------------------------------------------------------------------------------- /java/xmlrpc/ws-commons-util-1.0.2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/xmlrpc/ws-commons-util-1.0.2.jar -------------------------------------------------------------------------------- /python/torchtest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import torch 4 | 5 | zeros = torch.zeros(size=(3,4)) 6 | print(zeros) 7 | -------------------------------------------------------------------------------- /android/CounterService/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/android/CounterService/bin/resources.ap_ -------------------------------------------------------------------------------- /haskell/PCRESubTest.hs: -------------------------------------------------------------------------------- 1 | import PCRESub 2 | 3 | main = do 4 | let text = "me boo" =~$ ("(me) boo", "he \\1") 5 | print text 6 | -------------------------------------------------------------------------------- /haskell/maybe.hs: -------------------------------------------------------------------------------- 1 | import Data.Maybe 2 | 3 | main = do 4 | print $ Just "just" 5 | print $ fromMaybe "Nothing" $ Just "just" 6 | -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/CastleCoords.txt: -------------------------------------------------------------------------------- 1 | Castle.cob 2 | -p 7.3 2.2 -3.3 3 | -r 22222222221555555555555555555 4 | -s 27.372 5 | -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/houseCoords.txt: -------------------------------------------------------------------------------- 1 | house.wrl 2 | -p 0 0.5 1.1 3 | -r 334444444444443321344124433333333333 4 | -s 1.745 5 | -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/CASTLE.COB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/CASTLE.COB -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/column.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/column.3ds -------------------------------------------------------------------------------- /haskell/list.hs: -------------------------------------------------------------------------------- 1 | remove_second xs = 2 | head xs : tail (tail xs) 3 | 4 | main = do 5 | print $ remove_second [1, 2, 3, 4, 5, 6] 6 | -------------------------------------------------------------------------------- /haskell/regsub.hs: -------------------------------------------------------------------------------- 1 | import Text.Regex 2 | import Text.Regex.PCRE 3 | 4 | main = print $ subRegex (mkRegex "(me) boo") "me boo" "he \\1" 5 | -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/BoxConeSphereCoords.txt: -------------------------------------------------------------------------------- 1 | BoxConeSphere.wrl 2 | -p 0 0.6 0 3 | -r 555555555432111111111112 4 | -s 1.772 5 | -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/COOLROBO.3DS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/COOLROBO.3DS -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/models/dolphins.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/j3d/LoaderInfo3D/models/dolphins.3ds -------------------------------------------------------------------------------- /java/xmpp/Makefile: -------------------------------------------------------------------------------- 1 | SmackTest.class: SmackTest.java 2 | javac -cp lib/smack.jar SmackTest.java 3 | 4 | clean: 5 | rm SmackTest.class 6 | -------------------------------------------------------------------------------- /android/CounterService/bin/CounterService.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/android/CounterService/bin/CounterService.apk -------------------------------------------------------------------------------- /android/CounterService/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/android/CounterService/res/drawable/icon.png -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /stats/tstf/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | theme: { 3 | extend: {}, 4 | }, 5 | variants: {}, 6 | plugins: [], 7 | }; 8 | -------------------------------------------------------------------------------- /ruby/urlencode/u.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | 3 | require 'cgi' 4 | 5 | # Encode all parameters 6 | str = CGI.escape(ARGV.join("")) 7 | puts str 8 | -------------------------------------------------------------------------------- /haskell/powerset.hs: -------------------------------------------------------------------------------- 1 | powerSet' = foldr (\x -> concatMap (\xs -> [x:xs,xs])) [[]] 2 | 3 | main = do 4 | print $ powerSet' ['m', 'o', 'h', 'i', 't'] 5 | -------------------------------------------------------------------------------- /java/j3d/Random.java: -------------------------------------------------------------------------------- 1 | public class Random { 2 | public static void main(String[] args) { 3 | System.out.println(Math.random()); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /js/v8/SConstruct: -------------------------------------------------------------------------------- 1 | env = Environment( 2 | CPPPATH="/opt/dev/v8/include", 3 | LIBPATH="/opt/dev/v8") 4 | 5 | env.Program("test.cc", LIBS = "v8_g") 6 | -------------------------------------------------------------------------------- /ruby/push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./markdown.pl refresher.md >../www/rubyrefresher/index.html 4 | cp refresher.css ../www/rubyrefresher/refresher.css 5 | -------------------------------------------------------------------------------- /java/j3d/Loader3D/models/AaramCoords.txt: -------------------------------------------------------------------------------- 1 | Aaram.3ds 2 | -p 0 0.7 2.1 3 | -r 11111111111222226666666666555555566666621333335555555552221 4 | -s 1.668 5 | -------------------------------------------------------------------------------- /rust/hello/src/tuples.rs: -------------------------------------------------------------------------------- 1 | pub fn run() { 2 | let tup: (&str, &str, i32) = ("mo", "by", 42); 3 | 4 | println!("{} {} {}", tup.0, tup.1, tup.2); 5 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ruby_sess.* 2 | .*.swp 3 | .hi 4 | .[oa] 5 | *.pyc 6 | .svn 7 | .class 8 | *.o 9 | # except foo.o which is hand maintained 10 | !foo.o 11 | -------------------------------------------------------------------------------- /asm/old/Makefile: -------------------------------------------------------------------------------- 1 | all: asm 2 | 3 | asm.o: asm.S 4 | nasm -f elf asm.S 5 | 6 | asm: asm.o 7 | ld -o asm asm.o 8 | 9 | clean: 10 | rm asm asm.o 11 | -------------------------------------------------------------------------------- /emdr/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noImplicitAny": true, 4 | "target": "ES5", 5 | "module": "ES2015" 6 | } 7 | } -------------------------------------------------------------------------------- /ruby/gencsv.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # Generate a CSV: 100 lines of 10 random numbers per-line 3 | 100.times { puts ((1..10).map {rand(200)}).join(", ") } 4 | -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-icons_4eb305_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-icons_4eb305_256x240.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-icons_72b42d_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-icons_72b42d_256x240.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /cpp/double.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | printf("Sizeof float: %d\n", sizeof(float)); 5 | printf("Sizeof double: %d\n", sizeof(double)); 6 | } 7 | -------------------------------------------------------------------------------- /java/j3d/Checkers3D/Checkers3D.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Executing Java3D application... 3 | 4 | java -cp "%CLASSPATH%;..\j3dtree.jar" Checkers3D 5 | echo Finished. -------------------------------------------------------------------------------- /java/j3d/Checkers3D/compileChk.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Compiling Checkers3D files... 3 | 4 | javac -classpath "%CLASSPATH%;..\j3dtree.jar" *.java 5 | echo Finished. -------------------------------------------------------------------------------- /java/j3d/Loader3D/Loader3D.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Executing Java3D application... 3 | 4 | java -cp %CLASSPATH%;ncsa\portfolio.jar Loader3D %1 %2 5 | echo Finished. -------------------------------------------------------------------------------- /java/j3d/Loader3D/compileLd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Compiling Loader3D files... 3 | 4 | javac -classpath %CLASSPATH%;ncsa\portfolio.jar *.java 5 | echo Finished. -------------------------------------------------------------------------------- /ocaml/average.ml: -------------------------------------------------------------------------------- 1 | let average a b = 2 | (a +. b) /. 2.0;; 3 | 4 | 5 | Printf.printf "The average is %f\n" (average 5.0 6.0) 6 | 7 | (* (average 5.0 6.0) "\n" *) 8 | -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/compileLI.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Compiling LoaderInfo3D files... 3 | 4 | javac -classpath %CLASSPATH%;ncsa\portfolio.jar *.java 5 | echo Finished. -------------------------------------------------------------------------------- /java/test.java: -------------------------------------------------------------------------------- 1 | class HelloWorld { 2 | public static void main( String[] args ) throws TestException { 3 | System.out.println( "Hello World!" ); 4 | } 5 | } 6 | 7 | -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-icons_4eb305_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-icons_4eb305_256x240.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-icons_72b42d_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-icons_72b42d_256x240.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_glass_55_fbf5d0_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_glass_55_fbf5d0_1x400.png -------------------------------------------------------------------------------- /java/macbundle/GlassDemo.app/Contents/MacOS/JavaApplicationStub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/macbundle/GlassDemo.app/Contents/MacOS/JavaApplicationStub -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/dist/AsteriskClient.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/scala/NetBeansProjects/AsteriskClient/dist/AsteriskClient.jar -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_glass_55_fbf5d0_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_glass_55_fbf5d0_1x400.png -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/LoaderInfo3D.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Executing Java3D application... 3 | 4 | java -cp %CLASSPATH%;ncsa\portfolio.jar LoaderInfo3D %1 %2 5 | echo Finished. -------------------------------------------------------------------------------- /scala/HelloWorld.scala: -------------------------------------------------------------------------------- 1 | package com.muthanna.playground.scala 2 | 3 | object HelloWorld { 4 | def main(args: Array[String]) { 5 | println("Hello, world!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_inset-soft_10_285c00_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_inset-soft_10_285c00_1x100.png -------------------------------------------------------------------------------- /haskell/hello.hs: -------------------------------------------------------------------------------- 1 | -- Haskell is very very fast, so if you're calling this, you 2 | -- should be throttling. 3 | shouldThrottle = True 4 | 5 | main = do 6 | putStrLn "Hello World!" 7 | -------------------------------------------------------------------------------- /java/macbundle/GlassDemo.app/Contents/Resources/GenericJavaApp.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/java/macbundle/GlassDemo.app/Contents/Resources/GenericJavaApp.icns -------------------------------------------------------------------------------- /python/system.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | import sys 5 | 6 | os.system('echo hello'); 7 | 8 | print os.getcwd(); 9 | 10 | print "Arguments: ", sys.argv 11 | -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_inset-soft_10_285c00_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_inset-soft_10_285c00_1x100.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_highlight-hard_30_285c00_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_highlight-hard_30_285c00_1x100.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_highlight-soft_33_3a8104_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_highlight-soft_33_3a8104_1x100.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_highlight-soft_50_4eb305_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_highlight-soft_50_4eb305_1x100.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_highlight-soft_60_4ca20b_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_highlight-soft_60_4ca20b_1x100.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_diagonals-thick_15_444444_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_diagonals-thick_15_444444_40x40.png -------------------------------------------------------------------------------- /www/tone/css/le-frog/images/ui-bg_diagonals-thick_95_ffdc2e_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/tone/css/le-frog/images/ui-bg_diagonals-thick_95_ffdc2e_40x40.png -------------------------------------------------------------------------------- /haskell/TokenBucketTest.hs: -------------------------------------------------------------------------------- 1 | -- Test harness for TokenBucket module. 2 | -- Mohit Cheppudira 3 | 4 | import TokenBucket 5 | 6 | main :: IO () 7 | main = TokenBucket.test 8 | -------------------------------------------------------------------------------- /rust/btree/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "btree" 7 | version = "0.1.0" 8 | -------------------------------------------------------------------------------- /rust/stack/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "stack" 7 | version = "0.1.0" 8 | -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_diagonals-small_0_aaaaaa_40x40.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_diagonals-thick_15_444444_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_diagonals-thick_15_444444_40x40.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_diagonals-thick_95_ffdc2e_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_diagonals-thick_95_ffdc2e_40x40.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_highlight-hard_30_285c00_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_highlight-hard_30_285c00_1x100.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_highlight-soft_33_3a8104_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_highlight-soft_33_3a8104_1x100.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_highlight-soft_50_4eb305_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_highlight-soft_50_4eb305_1x100.png -------------------------------------------------------------------------------- /www/analyzer/css/le-frog/images/ui-bg_highlight-soft_60_4ca20b_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xfe/experiments/HEAD/www/analyzer/css/le-frog/images/ui-bg_highlight-soft_60_4ca20b_1x100.png -------------------------------------------------------------------------------- /js/v8/README: -------------------------------------------------------------------------------- 1 | To build the v8 libraries, see: 2 | 3 | http://code.google.com/apis/v8/build.html 4 | 5 | To build the code here: 6 | 7 | $ scons 8 | 9 | To clean: 10 | 11 | $ scons -c 12 | -------------------------------------------------------------------------------- /kernel/.hello.ko.cmd: -------------------------------------------------------------------------------- 1 | cmd_/home/mohit/work/test/linux/hello.ko := ld -m elf_i386 -r -o /home/mohit/work/test/linux/hello.ko /home/mohit/work/test/linux/hello.o /home/mohit/work/test/linux/hello.mod.o 2 | -------------------------------------------------------------------------------- /rust/hype/src/main.rs: -------------------------------------------------------------------------------- 1 | use hype::server::Server; 2 | 3 | #[tokio::main] 4 | async fn main() { 5 | let server = Server::new("127.0.0.1".into(), 4000); 6 | server.start().await.unwrap(); 7 | } 8 | -------------------------------------------------------------------------------- /asm/old/disasm.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int show(const char* msg) { 4 | printf(msg); 5 | } 6 | 7 | int main(int argc, char** argv) { 8 | show("Hello World\n"); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /haskell/join.hs: -------------------------------------------------------------------------------- 1 | join :: String -> [String] -> String 2 | join s (x : []) = x 3 | join s (x : xs) = x ++ s ++ (join s xs) 4 | join s [] = [] 5 | 6 | 7 | main = do 8 | print $ join ", " ["a", "b", "c"] 9 | -------------------------------------------------------------------------------- /rust/leetcode/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "leetcode" 7 | version = "0.1.0" 8 | -------------------------------------------------------------------------------- /haskell/readert.hs: -------------------------------------------------------------------------------- 1 | import Control.Monad.Reader 2 | 3 | doThis :: ReaderT String IO () 4 | doThis = do 5 | val <- ask 6 | liftIO . putStrLn $ val 7 | 8 | main = do 9 | runReaderT doThis "Boo" 10 | -------------------------------------------------------------------------------- /js/deno_test.js: -------------------------------------------------------------------------------- 1 | import { add } from "./denolib.ts"; 2 | import { assertEquals } from "https://deno.land/std@0.201.0/assert/mod.ts"; 3 | 4 | Deno.test("adder test", () => { 5 | assertEquals(add(1, 2), 3); 6 | }) -------------------------------------------------------------------------------- /scala/ForEach.scala: -------------------------------------------------------------------------------- 1 | package com.muthanna.playground.scala 2 | 3 | object ForEach { 4 | def main(args: Array[String]) { 5 | args.foreach(arg => println(arg)); 6 | args.foreach(println(_)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /java/xmlrpc/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | javac -cp xmlrpc-common-3.1.jar:xmlrpc-client-3.1.jar XmlRpcClientTest.java 4 | java -cp xmlrpc-common-3.1.jar:xmlrpc-client-3.1.jar:ws-commons-util-1.0.2.jar:. XmlRpcClientTest 5 | -------------------------------------------------------------------------------- /rust/btree/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "btree" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /rust/stack/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "stack" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /rust/leetcode/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "leetcode" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /stats/README.md: -------------------------------------------------------------------------------- 1 | # Start Jupyter in Docker on Mac 2 | 3 | ```bash 4 | $ brew cask install docker 5 | # Run Applications -> Docker 6 | $ docker run -it --rm -p 8888:8888 -v `pwd`:/home/jovyan/work jupyter/tensorflow-notebook 7 | ``` 8 | 9 | -------------------------------------------------------------------------------- /scala/Args.scala: -------------------------------------------------------------------------------- 1 | /* 2 | $ scalac-2.8 Args.scala 3 | $ scala-2.8 Args a b c 4 | A 5 | B 6 | C 7 | */ 8 | 9 | object Args { 10 | def main(args: Array[String]) { 11 | args.foreach(x => println(x toUpperCase)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /haskell/fold.hs: -------------------------------------------------------------------------------- 1 | main = do 2 | -- This won't compile. 3 | -- print $ foldl (:) [] [1..10] -- Does not compile, obviously! 4 | print $ foldr (:) [] [1..10] 5 | 6 | -- These work 7 | print $ foldl (+) 0 [1..10] 8 | print $ foldr (+) 0 [1..10] 9 | -------------------------------------------------------------------------------- /haskell/unwrapio.hs: -------------------------------------------------------------------------------- 1 | -- You can't unwrap an IO because it's a data constructor that's not 2 | -- in scope. 3 | 4 | somestring = return "ABC" 5 | 6 | unwrap (IO a) = a 7 | 8 | stuff = unwrap somestring 9 | 10 | main = do 11 | putStrLn stuff 12 | -------------------------------------------------------------------------------- /haskell/vector.hs: -------------------------------------------------------------------------------- 1 | data Vector a = Vector a a a 2 | deriving (Show) 3 | 4 | sumof :: (Num t) => Vector t -> t 5 | sumof (Vector a b c) = a + b + c 6 | 7 | main :: IO () 8 | main = do 9 | print $ sumof (Vector 1 2 3) 10 | print $ "Is all" 11 | -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=false 2 | do.depend=false 3 | do.jar=true 4 | javac.debug=true 5 | javadoc.preview=true 6 | user.properties.file=/Users/mmuthanna/.netbeans/6.7/build.properties 7 | -------------------------------------------------------------------------------- /scala/Privacy.scala: -------------------------------------------------------------------------------- 1 | package com.muthanna.playground.scala 2 | 3 | class PrivacyT(visible: Int) 4 | 5 | 6 | object Privacy { 7 | def main(args: Array[String]) { 8 | var p = new PrivacyT(5) 9 | println(p.visible) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /rust/threads/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "threads" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | rand = "0.8.5" 10 | -------------------------------------------------------------------------------- /cpp/brk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char** argv) { 5 | void *last_valid_address; 6 | 7 | last_valid_address = sbrk(0); 8 | 9 | printf("last_valid_address: %p\n", last_valid_address); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /ruby/parsecsv.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # Calculate mean of 4th column 4 | 5 | sum = 0 6 | num = 0 7 | 8 | ARGF.each do |line| 9 | line.chomp! 10 | sum += line.split(/\s*,\s*/)[4].to_i 11 | num += 1 12 | end 13 | 14 | puts(sum / num) 15 | 16 | -------------------------------------------------------------------------------- /java/servlets/beer/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /rust/hello/src/types.rs: -------------------------------------------------------------------------------- 1 | pub fn run() { 2 | let i: i64 = 4; 3 | 4 | println!("Max i64: {} i {}", std::i64::MAX, i); 5 | 6 | let is_active = true; 7 | let expr: char = 'x'; 8 | 9 | println!("bool: {}, char: {}", is_active, expr); 10 | } 11 | -------------------------------------------------------------------------------- /rust/leetcode/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod add_two_numbers; 2 | pub mod longest_palindromic_substring; 3 | pub mod longest_substring_without_repeating_characters; 4 | pub mod median_of_two_sorted_arrays; 5 | pub mod reverse_integer; 6 | pub mod two_sum; 7 | pub mod zigzag_conversion; 8 | -------------------------------------------------------------------------------- /cpp/whileone.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(int argc, char** argv) { 6 | long c = 1; 7 | 8 | while (1) { 9 | if ((++c % 10000000) == 0) { 10 | printf("%ld\n", c); 11 | } 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /python/colors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | class Colors: 4 | ESC = "\033[" 5 | PURPLE = ESC + "95m" 6 | GREEN = ESC + "92m" 7 | YELLOW = ESC + "93m" 8 | RESET = ESC + "0m" 9 | 10 | print Colors.YELLOW + "Warning: Colors enabled." 11 | print Colors.RESET 12 | -------------------------------------------------------------------------------- /java/DogTester.java: -------------------------------------------------------------------------------- 1 | public class DogTester { 2 | public static void main(String[] args) { 3 | Dog dog = new Dog(); 4 | dog.vigour = 4; 5 | dog.name = "Rufus"; 6 | 7 | dog.bark(); 8 | 9 | Dog nodog = new Dog(); 10 | nodog.bark(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /rust/echo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "echo" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | tokio = {version = "1", features = ["full"]} 10 | -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/AMIConnection.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * AMIConnection.scala 3 | * 4 | * To change this template, choose Tools | Template Manager 5 | * and open the template in the editor. 6 | */ 7 | 8 | package 9 | 10 | class AMIConnection { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /cpp/boost/BUILD: -------------------------------------------------------------------------------- 1 | On Mac OS X 2 | 3 | Download boost_1_35_0.tar.bz2 4 | 5 | ./configure 6 | make 7 | sudo make install 8 | 9 | symlink /usr/local/include/boost... to /usr/include 10 | 11 | Build as so: 12 | g++ unittest.cc -lboost_unit_test_framework-mt-1_35 -L/usr/local/lib 13 | -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /cpp/boost/scoped_test.cc: -------------------------------------------------------------------------------- 1 | #include "boost/scoped_ptr.hpp" 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | using boost::scoped_ptr; 7 | 8 | int main() { 9 | scoped_ptr s(new string("Scoped string.")); 10 | 11 | cout << *s << "\n"; 12 | } 13 | -------------------------------------------------------------------------------- /perl/printf.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | $f = -44.4234255234; 4 | $g = -44.4234223499816986969279472346213455234; 5 | 6 | printf "%2.6f", $f; 7 | 8 | print "\n"; 9 | 10 | print unpack("d", pack("d", $f)) . "\n"; 11 | print unpack("d", pack("d", $g)) . "\n"; 12 | 13 | print "\n"; 14 | -------------------------------------------------------------------------------- /www/mjk/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | 10 |
11 |
12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /stats/tstf/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/env", 4 | "@babel/typescript" 5 | ], 6 | "plugins": [ 7 | "@babel/proposal-class-properties", 8 | "@babel/proposal-object-rest-spread", 9 | "@babel/plugin-transform-runtime", 10 | ] 11 | } -------------------------------------------------------------------------------- /opencv/SConstruct: -------------------------------------------------------------------------------- 1 | env = Environment() 2 | 3 | # On OS X, install OpenCV from MacPorts. 4 | # 5 | # $ sudo port install opencv 6 | 7 | env.PrependENVPath('PATH', '/opt/local/bin') 8 | env.ParseConfig('pkg-config --cflags --libs opencv'); 9 | env.Program(target = 'capture', source = ["capture.cc"]) 10 | -------------------------------------------------------------------------------- /rust/threads/src/main.rs: -------------------------------------------------------------------------------- 1 | mod atomics; 2 | mod locks; 3 | mod thread; 4 | 5 | fn main() { 6 | thread::run1(); 7 | thread::run2(); 8 | thread::run3(); 9 | thread::run4(); 10 | thread::run5(); 11 | thread::run6(); 12 | 13 | atomics::run(); 14 | locks::run(); 15 | } 16 | -------------------------------------------------------------------------------- /python/mp3renamer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | # 3 | # mp3renamer - A tool for reorganizing audio file directories. Supports most 4 | # major audio file formats. 5 | # 6 | # Copyright (c) 2011 Mohit Muthanna Cheppudira 7 | # 8 | # MOVED TO: https://github.com/0xfe/mp3renamer 9 | -------------------------------------------------------------------------------- /scala/MapTest.scala: -------------------------------------------------------------------------------- 1 | package com.muthanna.playground.scala 2 | 3 | import java.lang.Integer; 4 | import java.util.Map; 5 | import java.util.HashMap; 6 | 7 | object MapTest { 8 | def main(args: Array[String]) { 9 | var aMap = new HashMap[Integer, String] 10 | println("boo"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /haskell/io.hs: -------------------------------------------------------------------------------- 1 | -- times :: Integer -> a -> m () 2 | times 0 f = return () 3 | times x f = do 4 | f 5 | times (x - 1) f 6 | 7 | -- This works because the type of main is IO t 8 | main = do 9 | putStrLn "How many more times?" 10 | inpStr <- getLine 11 | times (read inpStr) (putStrLn "Hello") 12 | 13 | -------------------------------------------------------------------------------- /js/greasemonkey/helloworld.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Hello World 3 | // @namespace http://muthanna.com/greasemonkey 4 | // @include * 5 | // @exclude http://muthanna.com/* 6 | // @exclude http://diveintogreasemonkey.org/* 7 | // ==/UserScript== 8 | 9 | GM_log('Running on ' + window.location.href); 10 | -------------------------------------------------------------------------------- /asm/old/asm.S: -------------------------------------------------------------------------------- 1 | section .data 2 | hello: db 'Hello World!', 10, 13 3 | helloLen: db $ - hello 4 | 5 | section .text 6 | global _start 7 | 8 | _start: 9 | mov eax, 4 10 | mov ebx, 2 11 | mov ecx, hello 12 | mov edx, [ helloLen ] 13 | int 80h 14 | 15 | mov ebx, eax 16 | mov eax, 1 17 | int 80h 18 | -------------------------------------------------------------------------------- /scala/Timer.scala: -------------------------------------------------------------------------------- 1 | package com.muthanna.playground.scala 2 | 3 | object Timer { 4 | def oncePerSecond(callback: () => Unit) { 5 | while (true) { callback(); Thread sleep 1000 } 6 | } 7 | 8 | def main(args: Array[String]) { 9 | oncePerSecond(() => 10 | println("Hello, world!")); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /stats/tstf/postcss.config.js: -------------------------------------------------------------------------------- 1 | /* eslint import/no-extraneous-dependencies: "off" */ 2 | 3 | const tailwindcss = require('tailwindcss'); 4 | const autoprefixer = require('autoprefixer'); 5 | 6 | module.exports = { 7 | plugins: [ 8 | tailwindcss('./tailwind.config.js'), 9 | autoprefixer, 10 | ], 11 | }; 12 | -------------------------------------------------------------------------------- /android/CounterService/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /rust/hype/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hype" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | name = "hype" 8 | path = "src/lib.rs" 9 | 10 | [[bin]] 11 | name = "main" 12 | path = "src/main.rs" 13 | 14 | [dependencies] 15 | tokio = { version = "1", features = ["full"] } 16 | lazy_static = "1.4" 17 | 18 | -------------------------------------------------------------------------------- /cpp/boost/simple.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main() { 7 | using namespace boost::lambda; 8 | 9 | typedef std::istream_iterator in; 10 | std::for_each( 11 | in(std::cin), in(), std::cout << (_1 * 3) << " "); 12 | } 13 | -------------------------------------------------------------------------------- /python/webapp/static/js/main.js: -------------------------------------------------------------------------------- 1 | function setup_validation() { 2 | var register_form = $("#register_form"); 3 | register_form.validate(); 4 | $("#repeat_password").rules("add", { equalTo: "#password" }); 5 | } 6 | 7 | require(["jquery.validate.js"], function(_) { 8 | $(function() { setup_validation() }); 9 | }); 10 | -------------------------------------------------------------------------------- /www/README: -------------------------------------------------------------------------------- 1 | This URL: 2 | 3 | 0xfe.muthanna.com 4 | 5 | Configured in LightHTTPD: 6 | 7 | $HTTP["host"] =~ "0xfe\.muthanna\.com" { 8 | server.document-root = "/home/mohit/x/www" 9 | accesslog.filename = "/home/mohit/var/log/access-log" 10 | server.indexfiles = ( "dispatch.fcgi", "index.html", "index.htm" ) 11 | } 12 | 13 | -------------------------------------------------------------------------------- /haskell/suffixes.hs: -------------------------------------------------------------------------------- 1 | import Data.List 2 | 3 | suffixes (x:xs) = (x:xs) : suffixes xs 4 | suffixes [] = [] 5 | 6 | suffixes2 = init . tails 7 | 8 | suffixes3 xs@(x:xs') = xs : suffixes xs' 9 | suffixes3 _ = [] 10 | 11 | main = do 12 | print $ suffixes "foobar" 13 | print $ suffixes2 "foobar" 14 | print $ suffixes3 "foobar" 15 | -------------------------------------------------------------------------------- /haskell/debugging.hs: -------------------------------------------------------------------------------- 1 | import Debug.Trace 2 | 3 | -- A neat debugging trick. Use "trace" in a guard that always fails 4 | -- to log a message every time the function is evaluated. 5 | 6 | f :: Int -> Int 7 | f n | trace ("f was called: " ++ show n) False = undefined 8 | f 0 = 1 9 | f n = n * f (n - 1) 10 | 11 | 12 | main = do 13 | print $ f 7 14 | -------------------------------------------------------------------------------- /ruby/midi/README.md: -------------------------------------------------------------------------------- 1 | Build MIDI file: 2 | 3 | $ gem install midilib 4 | $ ./midigen 5 | 6 | Convert to WAV: 7 | $ brew install fluidsynth 8 | $ fluidsynth -a coreaudio ~/w/audio/octave/FluidR3_GM.sf2 from_scratch.mid -F test.ra 9 | 10 | $ brew install sox 11 | $ sox -t raw -r 44100 -e signed -b 16 -c 2 test.raw ~/Downloads/test1.wav 12 | 13 | 14 | -------------------------------------------------------------------------------- /minikube/helm/minikube.yaml: -------------------------------------------------------------------------------- 1 | # Default values for dice. 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | app_prefix: helm 6 | 7 | main: 8 | image: 0xfe/dice/main 9 | pullPolicy: Never 10 | port: 3000 11 | 12 | server: 13 | image: 0xfe/dice/server 14 | pullPolicy: Never 15 | port: 3001 16 | -------------------------------------------------------------------------------- /ruby/nc.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # ./nc.rb localhost 22 4 | 5 | require 'socket' 6 | 7 | host, port = ARGV 8 | 9 | s = TCPSocket.open(host, port) 10 | 11 | total_bytes = 0 12 | 13 | while !s.eof? 14 | data = s.readline 15 | total_bytes += data.length 16 | puts data 17 | end 18 | 19 | s.close 20 | puts "\n\nRead #{data.length} bytes." 21 | -------------------------------------------------------------------------------- /rust/hello/src/vars.rs: -------------------------------------------------------------------------------- 1 | pub fn run() { 2 | let mut blah = "foo"; 3 | println!("{}", blah); 4 | blah = "bar"; 5 | println!("{}", blah); 6 | 7 | // Constants should have explicit types 8 | const ID: i32 = 001; 9 | println!("{}", ID); 10 | 11 | let (foo, bar) = ("hi", "bye"); 12 | println!("{} and {}", foo, bar); 13 | } 14 | -------------------------------------------------------------------------------- /rust/stack/src/main.rs: -------------------------------------------------------------------------------- 1 | mod stack; 2 | 3 | fn main() { 4 | println!("Hello, world!"); 5 | 6 | let mut s = stack::MoStack::new(); 7 | s.push(String::from("boo")); 8 | s.push(String::from("foo")); 9 | 10 | println!("pop {}", s.pop().unwrap()); 11 | println!("pop {}", s.pop().unwrap()); 12 | println!("pop {}", s.pop().unwrap()); 13 | } 14 | -------------------------------------------------------------------------------- /haskell/t1.hs: -------------------------------------------------------------------------------- 1 | import Data.Char 2 | 3 | data Tree a = TreeNode (Tree a) (Tree a) a | LeafNode a 4 | deriving (Show) 5 | 6 | process = map toUpper 7 | 8 | tree = TreeNode (LeafNode "a") (LeafNode "b") "r" 9 | 10 | main = do 11 | putStrLn "What's your name, bozo?" 12 | s <- getLine 13 | putStrLn $ "Hello " ++ (process s) ++ "!" 14 | putStrLn $ show tree 15 | -------------------------------------------------------------------------------- /minikube/tls/ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "Dice Kube Root CA", 3 | "key": { 4 | "algo": "rsa", 5 | "size": 2048 6 | }, 7 | "names": [ 8 | { 9 | "C": "CA", 10 | "L": "Waterloo", 11 | "O": "Dice Kube", 12 | "OU": "Dice Kube Root CA", 13 | "ST": "Canada" 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /go/empty.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | // Bottom is a valueless type 6 | type Bottom struct{} 7 | 8 | func main() { 9 | set := make(map[string]Bottom) 10 | exists := Bottom{} 11 | 12 | set["foo"] = exists 13 | set["bar"] = exists 14 | 15 | fmt.Printf("%v+\n", set) 16 | 17 | for k, v := range set { 18 | fmt.Printf("%v = %v\n", k, v) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/Dog.java: -------------------------------------------------------------------------------- 1 | class Dog { 2 | int vigour; 3 | String name; 4 | 5 | public Dog() { 6 | name = "Nobody"; 7 | vigour = 1; 8 | } 9 | 10 | public void bark() { 11 | String bark = ""; 12 | int x = 0; 13 | 14 | for (x = 0; x < vigour; x++) { 15 | bark += "Ruff!! "; 16 | } 17 | 18 | System.out.println(name + ": " + bark); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /kernel/hello.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static int hello_init(void) 5 | { 6 | printk(KERN_ALERT "Hello, world\n"); 7 | return 0; 8 | } 9 | 10 | static void hello_exit(void) 11 | { 12 | printk(KERN_ALERT "Goodbye, cruel world\n"); 13 | } 14 | 15 | module_init(hello_init); 16 | module_exit(hello_exit); 17 | 18 | 19 | -------------------------------------------------------------------------------- /www/jstest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /cs/hellocoffee.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 14 | -------------------------------------------------------------------------------- /cpp/istream.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | // build with: 7 | // g++ -o istream istream.cc 8 | 9 | using namespace std; 10 | 11 | int main(int argc, char** argv) { 12 | copy(istream_iterator(cin), 13 | istream_iterator(), 14 | ostream_iterator(cout)); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /java/servlets/beer/web/beer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="java.util.*" %> 2 | 3 | 4 | 5 |

Beer Recommendations

6 | 7 |

8 | 9 | <% 10 | List styles = (List)request.getAttribute("styles"); 11 | 12 | for (String style : styles) { 13 | out.print("Style: " + style + "
"); 14 | } 15 | %> 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /rust/hello/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hello" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | threadpool = "1.8.1" 10 | serde = { version = "1.0", features = ["derive"] } 11 | serde_json = "1.0" 12 | futures = "0.3" 13 | async-std = "1.12" 14 | reqwest = "0.11" 15 | -------------------------------------------------------------------------------- /asm/printf.asm: -------------------------------------------------------------------------------- 1 | global main 2 | extern printf 3 | default rel 4 | 5 | SECTION .data 6 | val dq 42 7 | 8 | SECTION .rodata 9 | hello db "Hello %ld!",10,0 10 | ; 11 | SECTION .text 12 | 13 | main: 14 | push rbx 15 | lea rdi, [hello] 16 | mov rsi, [val] 17 | xor rax, rax 18 | call printf 19 | mov rax, 0 20 | pop rbx 21 | ret 22 | -------------------------------------------------------------------------------- /haskell/file.hs: -------------------------------------------------------------------------------- 1 | module Main 2 | where 3 | 4 | import IO 5 | 6 | file = "file.txt" 7 | 8 | process :: String -> Int 9 | process contents = 10 | let x = read $ take 1 contents in 11 | x + 1 12 | 13 | main = do 14 | bracket (openFile file ReadMode) hClose 15 | (\h -> do contents <- hGetContents h 16 | putStrLn $ show $ process contents) 17 | putStrLn "All done!" 18 | -------------------------------------------------------------------------------- /ruby/wget.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # ./wget.rb www.google.com / 4 | 5 | require 'socket' 6 | 7 | host, path = ARGV 8 | port = 80 9 | 10 | s = TCPSocket.open(host, port) 11 | 12 | s.puts "GET #{path}" 13 | 14 | total_bytes = 0 15 | 16 | while !s.eof? 17 | data = s.readline 18 | total_bytes += data.length 19 | puts data 20 | end 21 | 22 | s.close 23 | puts "\n\nRead #{data.length} bytes." 24 | -------------------------------------------------------------------------------- /rust/hello/src/functions.rs: -------------------------------------------------------------------------------- 1 | fn greet(text: &str, name: &str) { 2 | println!("{}, {}!", text, name); 3 | } 4 | 5 | fn add(a: i32, b: i32) -> i32 { 6 | a + b 7 | } 8 | 9 | pub fn run() { 10 | println!("TEST: functions.rs"); 11 | greet("Hello", "Mo"); 12 | 13 | println!("Sum: {}", add(4,5)); 14 | 15 | let adder = |a: i32, b: i32| a + b; 16 | println!("Adder: {}", adder(4,5)); 17 | } -------------------------------------------------------------------------------- /rust/hello/src/generics.rs: -------------------------------------------------------------------------------- 1 | // You can use "where" to remove the generic type clutter form the 2 | // function signature 3 | fn add(a: T, b: T) -> T 4 | where T: std::ops::Add + std::fmt::Debug 5 | { 6 | // The debug trait lets you do this 7 | println!("{:?} + {:?}", a, b); 8 | // The Add trait lets you do this 9 | return a + b 10 | } 11 | 12 | pub fn run() { 13 | add(4, 5); 14 | } -------------------------------------------------------------------------------- /cpp/cin.cc: -------------------------------------------------------------------------------- 1 | // Author: mmuthanna@google.com (Mohit Cheppudira) 2 | // 3 | #include 4 | #include 5 | 6 | int main(int argc, char argv[]) { 7 | std::string a; 8 | 9 | std::cin >> a; 10 | std::cout << "1: " << a << std::endl; 11 | 12 | std::cin >> a; 13 | std::cout << "2: " << a << std::endl; 14 | 15 | if (a.empty()) { 16 | std::cout << "A is empty." << std::endl; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /java/HelloWorld.java: -------------------------------------------------------------------------------- 1 | class HelloWorld { 2 | public static void main(String[] args) { 3 | System.out.println("Hello World!"); 4 | System.out.println("I rule the world!"); 5 | 6 | int x = 0; 7 | 8 | while (x < 10) { 9 | System.out.println("Why not? " + x); 10 | x++; 11 | 12 | if (x == 3) { 13 | System.out.println("Because x is 3"); 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /haskell/stmonad.hs: -------------------------------------------------------------------------------- 1 | import Control.Monad.ST.Lazy 2 | import Data.STRef.Lazy 3 | 4 | for (a, n) f = if a > n then return () 5 | else do 6 | f a 7 | for (a + 1, n) f 8 | 9 | showA n = runST $ do 10 | r <- newSTRef 0 11 | for (1, n) (\x -> do 12 | val <- readSTRef r 13 | writeSTRef r (val + 1) 14 | ) 15 | readSTRef r 16 | 17 | main = do print $ showA 5 18 | -------------------------------------------------------------------------------- /rust/hello/src/print.rs: -------------------------------------------------------------------------------- 1 | pub fn run() { 2 | let a = format!("blah"); 3 | println!("{}", a); 4 | 5 | let pi = 3.14159; 6 | println!("{:1.3}", pi); 7 | 8 | #[derive(Debug)] 9 | struct MyType(i32); 10 | 11 | // Use debug print {:?} 12 | let b = MyType(4); 13 | println!("{:?}", b); 14 | 15 | println!("{} is from {}", "Mo", "Canada"); 16 | println!("{0:b} {0:x}", 16233); 17 | } 18 | -------------------------------------------------------------------------------- /www/something.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /rust/hello/src/strings.rs: -------------------------------------------------------------------------------- 1 | pub fn run() { 2 | let mut s = String::from("heyoooo "); 3 | 4 | s.push_str("foo!"); 5 | 6 | println!("{} {}", s, s.len()); 7 | 8 | if s.is_empty() { 9 | println!("empty!") 10 | } else { 11 | println!("not empty!") 12 | } 13 | 14 | // Immutable primitive string type 15 | let imm_s : &str = "boo"; 16 | println!("Immutable: {}", imm_s); 17 | } 18 | -------------------------------------------------------------------------------- /java/WriteFile.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | 3 | class WriteFile { 4 | public static void main(String[] args) { 5 | try { 6 | FileWriter fw = new FileWriter("model.xml"); 7 | 8 | fw.write("\n"); 9 | fw.write(" XML Sucks Balls\n"); 10 | fw.write("\n"); 11 | 12 | fw.close(); 13 | } catch(IOException ex) { 14 | ex.printStackTrace(); 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /python/webapp/static/style.css: -------------------------------------------------------------------------------- 1 | div.error { 2 | color: red; 3 | } 4 | 5 | body { 6 | font-family: Verdana; font-size: 96%; 7 | padding: 10px; 8 | } 9 | 10 | h2 { font-size: 20px; padding: 5px; } 11 | 12 | form { border: 0; padding: 10px; } 13 | 14 | fieldset { border: 0; } 15 | 16 | label { width: 10em; float: left; } 17 | 18 | label.error { 19 | float: none; color: red; padding-left: .5em; vertical-align: top; 20 | } 21 | -------------------------------------------------------------------------------- /rust/hype/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[macro_use] 2 | extern crate lazy_static; 3 | 4 | pub mod parser; 5 | pub mod response; 6 | pub mod server; 7 | pub mod status; 8 | 9 | pub fn add(left: usize, right: usize) -> usize { 10 | left + right 11 | } 12 | 13 | #[cfg(test)] 14 | mod tests { 15 | use super::*; 16 | 17 | #[test] 18 | fn it_works() { 19 | let result = add(2, 2); 20 | assert_eq!(result, 4); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /scala/JettyHello.scala: -------------------------------------------------------------------------------- 1 | package com.muthanna.playground.scala 2 | 3 | import org.eclipse.jetty.server.Server 4 | import org.eclipse.jetty.server.handler.DefaultHandler 5 | 6 | // This is written for Jetty 7 7 | 8 | object JettyHello { 9 | def main(args: Array[String]) { 10 | var server = new Server(8080) 11 | var handler = new DefaultHandler() 12 | 13 | handler.setServer(server) 14 | 15 | server.start() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /stats/tstf/stylelint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['stylelint-config-recommended'], 3 | rules: { 4 | 'at-rule-no-unknown': [true, { 5 | ignoreAtRules: [ 6 | 'tailwind', 7 | 'apply', 8 | 'variants', 9 | 'responsive', 10 | 'screen', 11 | ], 12 | }], 13 | 'declaration-block-trailing-semicolon': null, 14 | 'no-descending-specificity': null, 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /haskell/chan.hs: -------------------------------------------------------------------------------- 1 | import Control.Concurrent 2 | import Control.Concurrent.Chan 3 | import Control.Monad 4 | import Ix 5 | 6 | chanExample = do 7 | -- Create channel 8 | chan <- newChan 9 | 10 | -- Spawn 10 threads and send messages to the channel. 11 | forM_ (range (1,10)) (\i -> forkIO $ writeChan chan (show i)) 12 | 13 | -- Read messages from the channel. 14 | replicateM_ 10 (readChan chan >>= print) 15 | 16 | main = chanExample 17 | -------------------------------------------------------------------------------- /www/draggable.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 14 | 15 | 16 |

17 | DRAG THIS 18 |
19 | 20 | -------------------------------------------------------------------------------- /python/tornado_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | # Built for tornado 1.2 4 | 5 | import tornado.ioloop 6 | import tornado.web 7 | 8 | class MainHandler(tornado.web.RequestHandler): 9 | def get(self): 10 | self.write("Hello world!") 11 | 12 | application = tornado.web.Application([ 13 | (r"/", MainHandler), 14 | ]) 15 | 16 | if __name__ == "__main__": 17 | application.listen(8888) 18 | tornado.ioloop.IOLoop.instance().start() 19 | -------------------------------------------------------------------------------- /stats/hellotf.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | import numpy as np 3 | from tensorflow import keras 4 | 5 | model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])]) 6 | model.compile(optimizer='sgd', loss='mean_squared_error') 7 | 8 | xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float) 9 | ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float) 10 | 11 | model.fit(xs, ys, epochs=500) 12 | print(model.predict([10.0])) 13 | -------------------------------------------------------------------------------- /minikube/tls/intermediate-ca.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "Dice Kube Intermediate CA", 3 | "key": { 4 | "algo": "rsa", 5 | "size": 2048 6 | }, 7 | "names": [ 8 | { 9 | "C": "CA", 10 | "L": "Waterloo", 11 | "O": "Dice Kube", 12 | "OU": "Dice Kube Intermediate CA", 13 | "ST": "Canada" 14 | } 15 | ], 16 | "ca": { 17 | "expiry": "42720h" 18 | } 19 | } -------------------------------------------------------------------------------- /stats/tstf/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "parser": "babel-eslint", 3 | "env": { 4 | "browser": true, 5 | "jquery": true, 6 | "es6": true, 7 | "mocha": true, 8 | }, 9 | "parserOptions": { 10 | "sourceType": "module", 11 | "ecmaVersion": 6, 12 | }, 13 | "rules": { 14 | "max-len": [1, 180, 2, { ignoreComments: true }], 15 | "prefer-destructuring": "off", 16 | }, 17 | "extends": ["airbnb-base"] 18 | }; 19 | -------------------------------------------------------------------------------- /android/CounterService/default.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "build.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=Google Inc.:Google APIs:3 12 | -------------------------------------------------------------------------------- /haskell/avg.hs: -------------------------------------------------------------------------------- 1 | -- Custom average function calculates the length and sum in 2 | -- a single iteration. 3 | 4 | import System (getArgs) 5 | 6 | avg (x:xs) (sum,len) = avg xs ((x + sum), (len + 1)) 7 | avg [] (sum,len) = sum / (fromIntegral len) 8 | 9 | average xs = avg xs (0,0) 10 | 11 | main = do 12 | args <- getArgs 13 | 14 | if length args > 0 15 | then putStrLn $ show $ average [1 .. (read $ args!!0)] 16 | else putStrLn "Usage: avg " 17 | -------------------------------------------------------------------------------- /haskell/mvar.hs: -------------------------------------------------------------------------------- 1 | import Control.Concurrent 2 | import Control.Monad 3 | import Ix (range) 4 | 5 | communicate :: Int -> IO () 6 | communicate n = do 7 | m <- newEmptyMVar 8 | 9 | thread_list <- forM (range (1, n)) $ \i -> forkIO $ putMVar m i 10 | 11 | putStrLn $ "Started threads: " ++ show thread_list 12 | 13 | replicateM_ n $ do 14 | v <- takeMVar m 15 | putStrLn $ "Got: " ++ show v 16 | 17 | main :: IO () 18 | main = communicate 10 19 | -------------------------------------------------------------------------------- /emdr/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "plugins": [ 5 | "@typescript-eslint", 6 | "prettier" 7 | ], 8 | "extends": [ 9 | "eslint:recommended", 10 | "plugin:@typescript-eslint/eslint-recommended", 11 | "plugin:@typescript-eslint/recommended", 12 | "prettier" 13 | ], 14 | "rules": { 15 | "no-console": 1, // Means warning 16 | "prettier/prettier": 2 // Means error 17 | } 18 | } -------------------------------------------------------------------------------- /go/echo.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ("os" 4 | "flag") 5 | 6 | var omitNewLine = flag.Bool("n", false, "Omit new line") 7 | 8 | const (Space = " "; Newline = "\n") 9 | 10 | func main() { 11 | flag.Parse() 12 | 13 | var s string = ""; 14 | 15 | for i := 0; i < flag.NArg(); i++ { 16 | if i > 0 { s += Space } 17 | 18 | s += flag.Arg(i); 19 | } 20 | 21 | if !*omitNewLine { s += Newline } 22 | 23 | os.Stdout.WriteString(s) 24 | } 25 | -------------------------------------------------------------------------------- /android/CounterService/res/layout/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /haskell/readline.hs: -------------------------------------------------------------------------------- 1 | -- Test the readline library, with history recall. 2 | 3 | module Main (main) where 4 | 5 | import IO 6 | import Maybe 7 | import System.Console.Readline 8 | 9 | getline :: IO String 10 | getline = do 11 | line <- readline "> " 12 | let parsed_line = fromJust line 13 | addHistory parsed_line 14 | return $ parsed_line 15 | 16 | main :: IO () 17 | main = do 18 | line <- getline 19 | if line == "q" 20 | then return () 21 | else main 22 | -------------------------------------------------------------------------------- /java/servlets/beer/web/beer.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Select Beer

4 | 5 |
6 | Select Beer 7 | 8 |

9 | 10 | 16 | 17 |

18 | 19 |

20 | 21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /asterisk/res_hello.c: -------------------------------------------------------------------------------- 1 | #include "asterisk.h" 2 | 3 | ASTERISK_FILE_VERSION(__FILE__, "blah"); 4 | 5 | #include "asterisk/module.h" 6 | #include "asterisk/logger.h" 7 | 8 | static int load_module(void) { 9 | ast_log(LOG_NOTICE, "Hello World!\n"); 10 | return AST_MODULE_LOAD_SUCCESS; 11 | } 12 | 13 | static int unload_module(void) { 14 | ast_log(LOG_NOTICE, "Goodbye World!\n"); 15 | return 0; 16 | } 17 | 18 | AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Hello World"); 19 | -------------------------------------------------------------------------------- /haskell/concat.hs: -------------------------------------------------------------------------------- 1 | concatS:: String -> String -> String 2 | concatS s1 s2 = s1 ++ s2 3 | 4 | showI :: Int -> String 5 | showI i = show i 6 | 7 | -- g :: String -> Int -> String 8 | g n s = concatS (showI n) s 9 | 10 | -- foldright :: (String -> Int -> String) -> String -> [Int] -> String 11 | foldright h y [] = y 12 | foldright h y (x:xs) = h x (foldright h y xs) 13 | 14 | -- f :: [Int] -> String 15 | f l = foldright g "" l 16 | 17 | main = do 18 | print $ f [1,4,5] 19 | -------------------------------------------------------------------------------- /haskell/pardata.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE PArr #-} 2 | 3 | -- Testing Parallel Arrays 4 | -- $ ghc --make -threaded -fdph-par -fforce-recomp pardata.hs 5 | -- $ ./pardata +RTS -N2 6 | 7 | import Data.Array.Parallel.Prelude 8 | import qualified Data.Array.Parallel.Prelude.Double as D 9 | 10 | sumSq :: [: Double :] -> Double 11 | sumSq a = D.sumP (mapP (\x -> x * x) a) 12 | 13 | main :: IO () 14 | main = do 15 | let sum = sumSq [: 4, 5, 6, 3.2, 5.3, 45.2 :] 16 | putStrLn $ show sum 17 | -------------------------------------------------------------------------------- /haskell/xmlrep.hs: -------------------------------------------------------------------------------- 1 | data H_XML = Tag { name::String, children::[H_XML]} 2 | | Value { name::String, value::String } 3 | 4 | instance Show H_XML where 5 | show x = xml_show x 6 | 7 | instance Read H_XML where 8 | read x = xml_read x 9 | 10 | class XML_Rep a where 11 | toXML :: a -> H_XML 12 | fromXML :: H_XML -> a 13 | 14 | xml_show x = "String" 15 | xml_read x = Tag "Nothing" [Value "Int" "One"] 16 | 17 | main = do 18 | print $ show $ read "A" 19 | -------------------------------------------------------------------------------- /minikube/helm/dice/.helmignore: -------------------------------------------------------------------------------- 1 | # Patterns to ignore when building packages. 2 | # This supports shell glob matching, relative path matching, and 3 | # negation (prefixed with !). Only one pattern per line. 4 | .DS_Store 5 | # Common VCS dirs 6 | .git/ 7 | .gitignore 8 | .bzr/ 9 | .bzrignore 10 | .hg/ 11 | .hgignore 12 | .svn/ 13 | # Common backup files 14 | *.swp 15 | *.bak 16 | *.tmp 17 | *.orig 18 | *~ 19 | # Various IDEs 20 | .project 21 | .idea/ 22 | *.tmproj 23 | .vscode/ 24 | -------------------------------------------------------------------------------- /minikube/helm/k3s.yaml: -------------------------------------------------------------------------------- 1 | # Default values for dice. 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | app_prefix: helm 6 | 7 | main: 8 | image: northamerica-northeast2-docker.pkg.dev/pikube-369400/k3s/dice/main.arm64:latest 9 | pullPolicy: Always 10 | port: 3000 11 | 12 | server: 13 | image: northamerica-northeast2-docker.pkg.dev/pikube-369400/k3s/dice/server.arm64:latest 14 | pullPolicy: Always 15 | port: 3001 16 | -------------------------------------------------------------------------------- /rust/stack/src/stack.rs: -------------------------------------------------------------------------------- 1 | pub struct MoStack { 2 | items: Vec, 3 | pos: u32, 4 | } 5 | 6 | impl MoStack { 7 | pub fn new() -> MoStack { 8 | MoStack { 9 | items: vec![], 10 | pos: 0, 11 | } 12 | } 13 | 14 | pub fn push(&mut self, item: T) { 15 | self.items.push(item); 16 | self.pos += 1 17 | } 18 | 19 | pub fn pop(&mut self) -> Option { 20 | self.items.pop() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /haskell/splitlines.hs: -------------------------------------------------------------------------------- 1 | -- Cross platfrom line-splitting. 2 | -- Better than 'lines' 3 | 4 | splitLines [] = [] 5 | splitLines cs = 6 | let (pre, suf) = break isNewLine cs 7 | in pre : case suf of 8 | ('\r':'\n':rest) -> splitLines rest 9 | ('\r':rest) -> splitLines rest 10 | ('\n':rest) -> splitLines rest 11 | _ -> [] 12 | 13 | isNewLine c = c == '\r' || c == '\n' 14 | 15 | main = do 16 | print $ splitLines "Hello\nHow\rAre\r\nYou?" 17 | 18 | -------------------------------------------------------------------------------- /js/greasemonkey/renamer.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name Renamer 3 | // @namespace http://muthanna.com/greasemonkey 4 | // @include http://diveintogreasemonkey.org/* 5 | // @include http://www.diveintogreasemonkey.org/* 6 | // ==/UserScript== 7 | 8 | GM_log('Running on ' + window.location.href); 9 | 10 | var myDiv = document.getElementById('intro'); 11 | 12 | var link = myDiv.childNodes[1].childNodes[1].childNodes[1].childNodes[1]; 13 | 14 | link.innerHTML = "You've Been Owned"; 15 | -------------------------------------------------------------------------------- /asm/loop.asm: -------------------------------------------------------------------------------- 1 | global main 2 | extern printf 3 | 4 | SECTION .data 5 | val dq 42 6 | 7 | SECTION .rodata 8 | hello db "Hello %ld!",10,0 9 | ; 10 | SECTION .text 11 | 12 | main: 13 | push rbp 14 | mov r12, [val] 15 | 16 | loop_start: 17 | lea rdi, [hello] 18 | mov rsi, r12 19 | xor rax, rax 20 | call printf 21 | sub r12, 1 22 | jnz loop_start 23 | 24 | mov rax, 0 25 | pop rbp 26 | ret 27 | -------------------------------------------------------------------------------- /java/PhraseOMatic.java: -------------------------------------------------------------------------------- 1 | public class PhraseOMatic { 2 | public static void main(String[] args) { 3 | String[] wordlist1 = { "Say Goodnight", 4 | "To", 5 | "The", 6 | "Bad Guy" }; 7 | 8 | int random = (int) (Math.random() * wordlist1.length); 9 | 10 | System.out.println("Random = " + random); 11 | System.out.println("Length = " + wordlist1.length); 12 | System.out.println(wordlist1[random]); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ruby/README.md: -------------------------------------------------------------------------------- 1 | # Various Ruby Thingies 2 | 3 | ## The Ruby Refresher 4 | 5 | Moved to: http://github.com/0xfe/rubyrefresher 6 | 7 | * Get Markdown 8 | 9 | curl -O http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip 10 | 11 | * Unzip 12 | 13 | unzip Markdown_1.0.1.zip 14 | cp Markdown_1.0.1/Markdown.pl ~/c/bin/markdown.pl 15 | 16 | * Go! 17 | 18 | markdown.pl refresher.md >refresher.html 19 | 20 | ## Binary Heap / Priority Queue 21 | 22 | Moved to http://github/0xfe/vexruby_heap 23 | -------------------------------------------------------------------------------- /octave/timestretch.m: -------------------------------------------------------------------------------- 1 | function [output] = timestretch(audio, factor) 2 | % 3 | % Stretch audio track by 'factor'. 4 | % 5 | % Author: Mohit Muthanna Cheppudira 6 | % 7 | % Arguments: 8 | % audio: Audio data matrix (one channel per column) 9 | % factor: Stretching factor 10 | 11 | [samples, channels] = size(audio); 12 | output = []; 13 | 14 | for each_c = 1:channels 15 | output = [output interp1([1:samples]', audio(:,each_c), [1:1/factor:samples]', "nearest")]; 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /minikube/tls/ingress_host.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "dev", 3 | "key": { 4 | "algo": "rsa", 5 | "size": 2048 6 | }, 7 | "names": [ 8 | { 9 | "C": "CA", 10 | "L": "Waterloo", 11 | "O": "Dice Kube", 12 | "OU": "Dice Kube Ingress", 13 | "ST": "Canada" 14 | } 15 | ], 16 | "hosts": [ 17 | "dev", 18 | "dev.c.symbolic-axe-717.internal", 19 | "192.168.49.2", 20 | "dev.muthanna.com" 21 | ] 22 | } -------------------------------------------------------------------------------- /asm/Makefile: -------------------------------------------------------------------------------- 1 | targets = printf loop args atoi factorial mean 2 | 3 | all: $(targets) hello64 sum 4 | 5 | $(targets): $(targets:%=%.o) 6 | 7 | %.o: %.asm 8 | nasm -f elf64 -g -F dwarf -o $@ $< 9 | 10 | %: %.o 11 | gcc -no-pie -g -m64 -o $@ $< 12 | 13 | clean: 14 | rm *.o 15 | rm $(targets) hello64 sum 16 | 17 | # This one is special 18 | hello64: hello64.asm 19 | nasm -f elf64 -g -F dwarf -o $@.o $< 20 | ld -o hello64 hello64.o -I/lib64/ld-linux-x86-64.so.2 21 | 22 | sum: sum.o lib.o 23 | gcc -no-pie -g -m64 -o $@ $< lib.o -------------------------------------------------------------------------------- /java/servlets/first/etc/web.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | First Servlet 8 | FirstServlet 9 | 10 | 11 | 12 | First Servlet 13 | /first 14 | 15 | 16 | -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=93c66e97 2 | build.xml.script.CRC32=c7f8f588 3 | build.xml.stylesheet.CRC32=ca9d572e@1.3.0 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=93c66e97 7 | nbproject/build-impl.xml.script.CRC32=7afdae68 8 | nbproject/build-impl.xml.stylesheet.CRC32=bc42a706@1.3.0 9 | -------------------------------------------------------------------------------- /haskell/elf.hs: -------------------------------------------------------------------------------- 1 | -- Usage: elf 2 | 3 | import qualified Data.ByteString.Lazy as L 4 | import System (getArgs) 5 | 6 | hasElfMagic :: L.ByteString -> Bool 7 | hasElfMagic content = L.take 4 content == elfMagic 8 | where elfMagic = L.pack [0x7f, 0x45, 0x4c, 0x46] 9 | 10 | isElfFile :: FilePath -> IO Bool 11 | isElfFile path = do 12 | content <- L.readFile path 13 | return $ hasElfMagic content 14 | 15 | main = do 16 | args <- getArgs 17 | isElf <- isElfFile $ args !! 0 18 | putStrLn $ if isElf then "ELF" else "NOT ELF" 19 | -------------------------------------------------------------------------------- /haskell/interact.hs: -------------------------------------------------------------------------------- 1 | import System.Environment (getArgs) 2 | import Data.Char 3 | 4 | upperify = map toUpper 5 | 6 | interactWith function inputFile outputFile = do 7 | input <- readFile inputFile 8 | writeFile outputFile (function input) 9 | 10 | main = mainWith myFunction 11 | where mainWith function = do 12 | args <- getArgs 13 | case args of 14 | [input, output] -> interactWith function input output 15 | _ -> putStrLn "error: two arguments needed" 16 | 17 | myFunction = upperify 18 | -------------------------------------------------------------------------------- /python/challenges/house_robber.py: -------------------------------------------------------------------------------- 1 | # https://leetcode.com/problems/house-robber/ 2 | 3 | 4 | def rob(nums: list[int]) -> int: 5 | highest = 0 6 | for i, v in enumerate(nums): 7 | if i in (0, 1): 8 | pass 9 | elif i == 2: 10 | nums[i] = v + nums[i - 2] 11 | else: 12 | nums[i] = v + max(nums[i - 2], nums[i - 3]) 13 | 14 | highest = max(highest, nums[i]) 15 | 16 | return highest 17 | 18 | 19 | assert rob([1, 2, 3, 1]) == 4 20 | assert rob([2, 7, 9, 3, 1]) == 12 21 | -------------------------------------------------------------------------------- /haskell/binary.hs: -------------------------------------------------------------------------------- 1 | import qualified Data.ByteString.Lazy.Char8 as L8 2 | import Control.Monad 3 | import Control.Applicative 4 | import Data.Char 5 | 6 | hello :: L8.ByteString 7 | hello = L8.pack "Hello World" 8 | 9 | ordify :: L8.ByteString -> [Int] 10 | ordify s = map ord (L8.unpack s) 11 | 12 | main = do 13 | L8.putStrLn hello 14 | print hello 15 | print $ ordify hello 16 | 17 | -- <$> = fmap 18 | ordify <$> (L8.readFile "binaryfile") >>= print 19 | 20 | -- same as above 21 | (L8.readFile "binaryfile") >>= (print . ordify) 22 | -------------------------------------------------------------------------------- /images/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | INPUT=$1 4 | OUTPUT=$2 5 | TMP=/tmp/snfsoudnf 6 | 7 | if [ "$2" == "" ]; then 8 | echo "Usage: $0 input output" 9 | exit 10 | fi 11 | 12 | echo Blurring... 13 | convert $INPUT -threshold '85%' -gaussian-blur 20 -quality 20 ${TMP}1.jpg 14 | 15 | echo Tracing... 16 | autotrace -despeckle-level 9 -despeckle-tightness 0.6 \ 17 | -error-threshold 1 -output-format pdf -filter-iterations 8 \ 18 | -report-progress ${TMP}1.jpg >${TMP}2.pdf 19 | 20 | echo Downsampling... 21 | convert ${TMP}2.pdf -quality 20 $OUTPUT 22 | -------------------------------------------------------------------------------- /kernel/hello.mod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | MODULE_INFO(vermagic, VERMAGIC_STRING); 6 | 7 | #undef unix 8 | struct module __this_module 9 | __attribute__((section(".gnu.linkonce.this_module"))) = { 10 | .name = __stringify(KBUILD_MODNAME), 11 | .init = init_module, 12 | #ifdef CONFIG_MODULE_UNLOAD 13 | .exit = cleanup_module, 14 | #endif 15 | }; 16 | 17 | static const char __module_depends[] 18 | __attribute_used__ 19 | __attribute__((section(".modinfo"))) = 20 | "depends="; 21 | 22 | -------------------------------------------------------------------------------- /rust/hello/src/args.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | pub fn run() { 4 | let args: Vec = env::args().collect(); 5 | 6 | println!("Args: {:?}", args); 7 | 8 | let target = args[0].clone(); 9 | println!("$0 = {}", target); 10 | 11 | #[derive(Debug, Clone)] 12 | struct MoStruct { 13 | i: i64, 14 | f: f64, 15 | } 16 | 17 | let mo = MoStruct{i: 4, f: 4.4}; 18 | println!("mo {:?}", mo); 19 | 20 | let boo = mo.clone(); 21 | println!("boo {:?}", boo); 22 | 23 | println!("{}, {}", boo.i, boo.f); 24 | } -------------------------------------------------------------------------------- /haskell/factrec.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE FlexibleInstances #-} 2 | 3 | y f = f $ y ( f ) 4 | 5 | factRec g x = case x of 6 | 0 -> 1 7 | _ -> x * (g (x - 1)) 8 | 9 | fact = y factRec 10 | 11 | fibRec g x = case x of 12 | 0 -> 0 13 | 1 -> 1 14 | _ -> (g (x - 1) + g (x - 2)) 15 | 16 | fib = y fibRec 17 | 18 | reduceRec g f l = case l of 19 | [] -> undefined 20 | [x] -> x 21 | (x : xs) -> f x (g f xs) 22 | 23 | reduce = y reduceRec 24 | -------------------------------------------------------------------------------- /minikube/helm/dice/values.yaml: -------------------------------------------------------------------------------- 1 | # Default values for dice. 2 | # This is a YAML-formatted file. 3 | # Declare variables to be passed into your templates. 4 | 5 | app_prefix: helm 6 | ingressHost: "*.dice.pikube" 7 | nfs_server: nuc 8 | nfs_path: "/opt/nfs_share" 9 | 10 | main: 11 | image: northamerica-northeast2-docker.pkg.dev/pikube-369400/k3s/dice/main.arm64:latest 12 | pullPolicy: Always 13 | port: 3000 14 | 15 | server: 16 | image: northamerica-northeast2-docker.pkg.dev/pikube-369400/k3s/dice/server.arm64:latest 17 | pullPolicy: Always 18 | port: 3001 -------------------------------------------------------------------------------- /cpp/boost/tags: -------------------------------------------------------------------------------- 1 | BOOST_AUTO_TEST_CASE unittest.cc /^BOOST_AUTO_TEST_CASE(case2) {$/ 2 | BOOST_AUTO_TEST_SUITE unittest.cc /^BOOST_AUTO_TEST_SUITE(adder)$/ 3 | FreeFunction bind.cc /^void FreeFunction(int num) {$/ 4 | FreeWithReturn bind.cc /^int FreeWithReturn(int num) {$/ 5 | Mbind.cc bind.cc /^int main() {$/ 6 | Mfunction.cc function.cc /^int main() {$/ 7 | Mscoped_test.cc scoped_test.cc /^int main() {$/ 8 | Msimple.cc simple.cc /^int main() {$/ 9 | add unittest.cc /^int add(int i, int j) { return i + j; }$/ 10 | in simple.cc /^ typedef std::istream_iterator in;$/ 11 | -------------------------------------------------------------------------------- /r/waves.rscript: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env Rscript 2 | # 3 | # Quick test to see how zero-phase sine and cosine waves 4 | # correlate. 5 | # 6 | # Ans: They don't. 7 | 8 | waves <- function() { 9 | l <- 4 * pi 10 | 11 | # Create plot window of 2 rows by 2 columns 12 | par(mfrow=c(2,2)) 13 | 14 | a <- sin(seq(0, l, length=1000)) 15 | b <- cos(seq(0, l, length=1000)) 16 | 17 | c <- a * b 18 | 19 | plot(a, type="l") 20 | plot(b, type="l") 21 | plot(c, type="l") 22 | 23 | cat("Correlation: ", sum(c), "\n") # Displays a near-zero number 24 | } 25 | 26 | waves() 27 | -------------------------------------------------------------------------------- /python/webapp/static/js/user_api.js: -------------------------------------------------------------------------------- 1 | User = function(url) { 2 | this.init(url) 3 | } 4 | 5 | User.prototype.init = function(url) { 6 | this.url = url; 7 | } 8 | 9 | User.prototype.login = function(email, handler) { 10 | Vex.Ajax(this.url, { 'action': 'ajax_login', 'email': email }, handler); 11 | } 12 | 13 | User.prototype.register = function(email, name, password, handler) { 14 | Vex.Ajax(this.url, 15 | { 'action': "ajax_register", 16 | 'email':email, 17 | 'name': name, 18 | 'password': password 19 | }, handler); 20 | } 21 | -------------------------------------------------------------------------------- /scala/README: -------------------------------------------------------------------------------- 1 | Compiling 2 | 3 | $ scalac HelloWorld.scala 4 | $ fsc HelloWorld.scala (Faster) 5 | 6 | Running 7 | 8 | $ scala -cp . com.muthanna.playground.scala.HelloWorld 9 | 10 | Jetty Compiling (Jetty 7) 11 | 12 | $ fsc -cp '/opt/local/temp/jetty-distribution-7.0.0.RC4/lib/*' JettyHello.scala 13 | 14 | Jetty Runing (Remember to add . to classpath) 15 | 16 | $ scala -cp '/opt/local/temp/jetty-distribution-7.0.0.RC4/lib/*:.' com.muthanna.playground.scala.JettyHello 17 | 18 | Note that all the servlet stuff is Jetty 6 19 | 20 | YAML 21 | 22 | SnakeYAML: http://code.google.com/p/snakeyaml 23 | -------------------------------------------------------------------------------- /cpp/container.cc: -------------------------------------------------------------------------------- 1 | // Author: mmuthanna@google.com (Mohit Cheppudira) 2 | // 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | template 9 | class Container { 10 | public: 11 | T internal; 12 | static Container* lastInstance; 13 | 14 | Container(T value) { 15 | internal = value; 16 | lastInstance = this; 17 | } 18 | }; 19 | 20 | int main(int argc, char** argv) { 21 | Container* str = new Container("abc"); 22 | Container* i = new Container(1); 23 | 24 | cout << str->lastInstance->internal << "\n"; 25 | } 26 | -------------------------------------------------------------------------------- /haskell/euler1.hs: -------------------------------------------------------------------------------- 1 | -- Project Euler: Problem 1 2 | -- Author: Mohit Muthanna Cheppudira 3 | -- 4 | -- If we list all the natural numbers below 10 that are multiples of 3 or 5, 5 | -- we get 3, 5, 6 and 9. The sum of these multiples is 23. 6 | -- 7 | -- Find the sum of all the multiples of 3 or 5 below 1000. 8 | 9 | import System (getArgs) 10 | 11 | sum35 :: Int -> Int 12 | sum35 n = sum $ filter multiple35 $ [1..n-1] 13 | where multiple35 a = any ((== 0) . (a `mod`)) [3, 5] 14 | 15 | main :: IO () 16 | main = do 17 | a <- getArgs 18 | print $ sum35 $ if length a == 0 then 1000 else read $ a !! 0 19 | -------------------------------------------------------------------------------- /python/challenges/easy_div7_not5.py: -------------------------------------------------------------------------------- 1 | # https://github.com/zhiwehu/Python-programming-exercises/blob/master/100%2B%20Python%20challenging%20programming%20exercises.txt 2 | 3 | 4 | """ 5 | Question 1 6 | Level 1 7 | 8 | Question: 9 | Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, 10 | between 2000 and 3200 (both included). 11 | The numbers obtained should be printed in a comma-separated sequence on a single line. 12 | """ 13 | 14 | 15 | def solve(): 16 | return [x for x in range(2000, 3200) if x % 7 == 0 and x % 5 != 0] 17 | 18 | 19 | print(solve()) 20 | -------------------------------------------------------------------------------- /haskell/random.hs: -------------------------------------------------------------------------------- 1 | module Main 2 | where 3 | 4 | import IO 5 | import Random 6 | 7 | doGuessing num = do 8 | putStrLn "Your guess?" 9 | guess <- getLine 10 | let guessNum = read guess 11 | if guessNum < num 12 | then do putStrLn "Too low!" 13 | doGuessing num 14 | else if guessNum > num 15 | then do putStrLn "Too high" 16 | doGuessing num 17 | else do putStrLn "Correct!" 18 | 19 | main = do 20 | hSetBuffering stdin LineBuffering 21 | num <- randomRIO(1::Int, 100) 22 | putStrLn "I'm thinking of a number between 1 and 100" 23 | doGuessing num 24 | -------------------------------------------------------------------------------- /go/parity.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | // Parity is a naive parity calculator 6 | func Parity(v int64) int64 { 7 | parity := int64(0) 8 | 9 | for v > 0 { 10 | parity ^= v & 1 11 | v >>= 1 12 | } 13 | 14 | return parity 15 | } 16 | 17 | func main() { 18 | fmt.Printf("1 << 0: %v\n", 1<<0) 19 | fmt.Printf("1 << 1: %v\n", 1<<1) 20 | fmt.Printf("1 << 2: %v\n", 1<<2) 21 | fmt.Printf("1 << 3: %v\n", 1<<3) 22 | fmt.Printf("parity of 1: %v\n", Parity(1)) 23 | fmt.Printf("parity of 2: %v\n", Parity(2)) 24 | fmt.Printf("parity of 3: %v\n", Parity(3)) 25 | fmt.Printf("parity of 4: %v\n", Parity(4)) 26 | } 27 | -------------------------------------------------------------------------------- /haskell/PNM.hs: -------------------------------------------------------------------------------- 1 | import qualified Data.ByteString.Lazy.Char8 as L8 2 | import qualified Data.ByteString.Lazy as L 3 | import Data.Char (isSpace) 4 | 5 | data Greymap = Greymap { 6 | greyWidth :: Int, 7 | greyHeight :: Int, 8 | greyMax :: Int, 9 | greyData :: L.ByteString 10 | } deriving (Eq) 11 | 12 | instance Show Greymap where 13 | show (Greymap w h m _) = "Greymap " ++ show w ++ "x" ++ 14 | show h ++ " " ++ show m 15 | 16 | parseP5 :: L.ByteString -> Maybe (Greymap, L.ByteString) 17 | 18 | main = do 19 | putStrLn "Greymap 1.0" 20 | -- print $ Greymap 4 5 6 (L.ByteString "ABC") 21 | 22 | -------------------------------------------------------------------------------- /asterisk/test_call.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # SPOOL=/var/spool/asterisk/outgoing 4 | SPOOL=/opt/asterisk/var/spool/asterisk/outgoing 5 | TEMP=`/bin/mktemp /tmp/$0.XXXXXX` 6 | SOURCE=172.25.189.35 7 | TARGET=$1 8 | MESSAGE=$2 9 | 10 | cat >$TEMP < 2 | 3 | App 4 | 6 | 7 | 8 | 9 |

10 | 11 | {{ _("Current user:") }} {{ escape(user) }} 12 | 13 |

14 | 15 | {{ _("Received Action:") }} {{ escape(action) }} 16 | 17 |

18 | 19 |

20 | {% for error in errors %} 21 | {{ error }} 22 | {% end %} 23 |
24 | 25 |

26 | 27 | 28 | 29 |

30 | 31 | 32 | -------------------------------------------------------------------------------- /java/servlets/first/src/FirstServlet.java: -------------------------------------------------------------------------------- 1 | import javax.servlet.*; 2 | import javax.servlet.http.*; 3 | import java.io.*; 4 | 5 | public class FirstServlet extends HttpServlet { 6 | public void doGet(HttpServletRequest request, 7 | HttpServletResponse response) 8 | throws IOException { 9 | PrintWriter out = response.getWriter(); 10 | java.util.Date today = new java.util.Date(); 11 | 12 | out.println("" + 13 | "" + 14 | "

Today is " + today + 15 | "

" + 16 | "" + 17 | ""); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /rust/hello/src/threadpool.rs: -------------------------------------------------------------------------------- 1 | pub struct ThreadPool { 2 | size: usize, 3 | } 4 | 5 | impl ThreadPool { 6 | fn new(size: usize) -> ThreadPool { 7 | assert!(size > 0); 8 | ThreadPool { size } 9 | } 10 | 11 | fn size(&self) -> usize { 12 | return self.size; 13 | } 14 | } 15 | 16 | pub fn run() { 17 | println!("running threadpool"); 18 | let tp = ThreadPool::new(10); 19 | println!("size: {}", tp.size()); 20 | } 21 | 22 | #[cfg(test)] 23 | mod tests { 24 | use super::*; 25 | 26 | #[test] 27 | fn new_pool() { 28 | let tp = ThreadPool::new(5); 29 | assert_eq!(tp.size(), 5); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/servlets/beer/src/com/model/BeerExpert.java: -------------------------------------------------------------------------------- 1 | package com.model; 2 | 3 | import java.util.*; 4 | 5 | public class BeerExpert { 6 | public List getBrands(String color) { 7 | List brands = new ArrayList(); 8 | 9 | if (color.equals("amber")) { 10 | brands.add("Jack Amber"); 11 | brands.add("Red Moose"); 12 | } else { 13 | brands.add("Some Pale Ale"); 14 | brands.add("Gout Stout"); 15 | } 16 | 17 | return brands; 18 | } 19 | 20 | public static void main(String[] args) { 21 | for (String b : new BeerExpert().getBrands("amber")) { 22 | System.out.println("Brand: " + b); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.scala.project 4 | 5 | 6 | AsteriskClient 7 | 1.6.5 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /python/pigame.py: -------------------------------------------------------------------------------- 1 | import sys, pygame 2 | pygame.init() 3 | 4 | size = width, height = 320, 240 5 | speed = [2, 2] 6 | black = 0, 0, 0 7 | 8 | screen = pygame.display.set_mode(size) 9 | 10 | ball = pygame.image.load("marilyn.jpg") 11 | ballrect = ball.get_rect() 12 | 13 | while 1: 14 | for event in pygame.event.get(): 15 | if event.type == pygame.QUIT: sys.exit() 16 | 17 | ballrect = ballrect.move(speed) 18 | 19 | if ballrect.left < 0 or ballrect.right > width: 20 | speed[0] = -speed[0] 21 | 22 | if ballrect.top < 0 or ballrect.bottom > height: 23 | speed[1] = -speed[1] 24 | 25 | screen.fill(black) 26 | screen.blit(ball, ballrect) 27 | pygame.display.flip() 28 | -------------------------------------------------------------------------------- /opencv/capture.cc: -------------------------------------------------------------------------------- 1 | #include "highgui.h" 2 | 3 | /* 4 | * Usage: 5 | * capture [video_file] 6 | */ 7 | 8 | int main( int argc, char** argv ) { 9 | cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE ); 10 | CvCapture* capture; 11 | 12 | if (argc < 2) { 13 | capture = cvCreateCameraCapture(0); 14 | } else { 15 | capture = cvCreateFileCapture( argv[1] ); 16 | } 17 | 18 | IplImage* frame; 19 | while(1) { 20 | frame = cvQueryFrame( capture ); 21 | if( !frame ) break; 22 | cvShowImage( "Example2", frame ); 23 | char c = cvWaitKey(33); 24 | if( c == 27 ) break; 25 | } 26 | cvReleaseCapture( &capture ); 27 | cvDestroyWindow( "Example2" ); 28 | } 29 | -------------------------------------------------------------------------------- /rust/hello/src/pointers.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::Debug; 2 | use std::ops::Deref; 3 | 4 | #[derive(Debug)] 5 | struct MyBox(T); 6 | 7 | impl MyBox { 8 | fn new(t: T) -> MyBox { 9 | return MyBox(t); 10 | } 11 | } 12 | 13 | impl Deref for MyBox { 14 | type Target = T; 15 | 16 | fn deref(&self) -> &Self::Target { 17 | return &self.0; 18 | } 19 | } 20 | 21 | impl Drop for MyBox { 22 | fn drop(&mut self) { 23 | println!("goodbye {:?}!", *self) 24 | } 25 | } 26 | 27 | pub fn run() { 28 | let i = MyBox::new(25); 29 | println!("i = {}", *i); 30 | 31 | let j = MyBox::new(30); 32 | drop(j); 33 | } 34 | -------------------------------------------------------------------------------- /python/curses_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import curses 4 | import time 5 | 6 | stdscr = curses.initscr() 7 | 8 | # Allow color 9 | curses.start_color() 10 | 11 | # Disable echoing of input keys 12 | curses.noecho() 13 | 14 | # React to keys without Enter key needed 15 | curses.cbreak() 16 | 17 | # Allow special keys 18 | stdscr.keypad(1) 19 | 20 | # Create a color pair 21 | curses.init_pair(1, curses.COLOR_YELLOW, curses.COLOR_BLACK) 22 | 23 | stdscr.addstr("Hello Curses!\n\n", curses.A_BOLD) 24 | stdscr.addstr("Hit 'q' to quit.", curses.color_pair(1) | curses.A_BOLD) 25 | stdscr.refresh() 26 | 27 | while True: 28 | c = stdscr.getch() 29 | if c == ord('q'): break 30 | 31 | curses.endwin() 32 | -------------------------------------------------------------------------------- /minikube/dice/dice.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | option go_package = "0xfe/experiments/minikube/dice"; 4 | 5 | enum Face { 6 | FACE_HEADS = 0; 7 | FACE_TAILS = 1; 8 | } 9 | 10 | message DiceRoll { 11 | int32 id = 1; 12 | Face face = 2; 13 | } 14 | 15 | message RollTable { 16 | string roller_handle = 1; 17 | repeated DiceRoll rolls = 2; 18 | } 19 | 20 | message RollRequest { 21 | string roller_handle = 1; 22 | } 23 | 24 | message RollResponse {} 25 | 26 | message GetRollsRequest {} 27 | 28 | service RollService { 29 | rpc Roll(RollRequest) returns (RollResponse); 30 | 31 | // Single request, streaming response 32 | rpc GetRolls(GetRollsRequest) returns (stream RollTable); 33 | } -------------------------------------------------------------------------------- /emdr/src/logger.ts: -------------------------------------------------------------------------------- 1 | let LOGLEVEL = 50; 2 | 3 | function log(level: number, ...args: string[]) { 4 | if (level <= LOGLEVEL) { 5 | // eslint-disable-next-line 6 | console.log(`[pitchy:${level}]`, ...args); 7 | } 8 | } 9 | 10 | function debug(...args: string[]) { 11 | log(50, ...args); 12 | } 13 | 14 | function info(...args: string[]) { 15 | log(30, ...args); 16 | } 17 | 18 | function warn(...args: string[]) { 19 | log(20, ...args); 20 | } 21 | 22 | function error(...args: string[]) { 23 | log(10, ...args); 24 | } 25 | 26 | function setLevel(level: number) { 27 | info('Setting log level to', level.toString()); 28 | LOGLEVEL = level; 29 | } 30 | 31 | export { 32 | log, debug, info, warn, error, setLevel, 33 | }; -------------------------------------------------------------------------------- /haskell/typeclass.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TypeSynonymInstances #-} 2 | 3 | data JValue = JBool Bool | 4 | JString String 5 | deriving (Show) 6 | 7 | class JSON a where 8 | toJValue :: a -> JValue 9 | fromJValue :: JValue -> Maybe a 10 | 11 | instance JSON JValue where 12 | toJValue = id 13 | fromJValue = Just 14 | 15 | instance JSON Bool where 16 | toJValue = JBool 17 | fromJValue (JBool b) = Just b 18 | fromJValue _ = Nothing 19 | 20 | fromMaybe defval Nothing = defval 21 | fromMaybe defval (Just v) = v 22 | 23 | main = do 24 | print $ fromMaybe "Nothing" (Just "A") 25 | print $ fromMaybe "Nothing" Nothing 26 | print $ toJValue True 27 | print $ ((fromJValue (toJValue False)) :: Maybe Bool) 28 | -------------------------------------------------------------------------------- /java/servlets/beer/src/com/test/BeerListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package com.test; 7 | 8 | import javax.servlet.*; 9 | 10 | /** 11 | * Web application lifecycle listener. 12 | * @author mmuthanna 13 | */ 14 | 15 | public class BeerListener implements ServletContextListener { 16 | 17 | public void contextInitialized(ServletContextEvent arg0) { 18 | ServletContext sc = arg0.getServletContext(); 19 | sc.setAttribute("jazz", "Renee Olstead"); 20 | } 21 | 22 | public void contextDestroyed(ServletContextEvent arg0) { 23 | throw new UnsupportedOperationException("Not supported yet."); 24 | } 25 | } -------------------------------------------------------------------------------- /scala/NetBeansProjects/AsteriskClient/src/asteriskclient/Main.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Main.scala 3 | * 4 | * To change this template, choose Tools | Template Manager 5 | * and open the template in the editor. 6 | */ 7 | 8 | package asteriskclient 9 | 10 | import scala.util.logging._; 11 | 12 | object Main { 13 | def main(args: Array[String]) { 14 | val conn = new AMIConnection("localhost", 7777) with ConsoleLogger 15 | val gateway = new AMIClient(conn) 16 | 17 | try { 18 | conn.connect 19 | val response = gateway.login("mohit", "password") 20 | println(response.toString) 21 | } catch { 22 | case e: AMIConnectionException => println("Not connected.") 23 | } finally { 24 | conn.disconnect 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /haskell/quicksort.hs: -------------------------------------------------------------------------------- 1 | -- quick and dirty super simple quicksort functions 2 | 3 | sort (x:xs) = lesser ++ x:greater 4 | where lesser = sort $ filter (x) xs 6 | sort _ = [] 7 | 8 | sort1 (x:xs) = (pivot (x) 9 | where pivot f = sort1 $ filter f xs 10 | sort1 _ = [] 11 | 12 | sort2 (x:xs) = sort2 [y | y <-xs, y < x] ++ x : sort2 [y | y <-xs, y > x] 13 | sort2 _ = [] 14 | 15 | sort3 (x:xs) = (sort3 $ filter (x) xs) 16 | sort3 _ = [] 17 | 18 | myarray = [3,4,6,2,4,1,39,4,48,3,43,23,18,04] 19 | 20 | main = do print $ sort myarray 21 | print $ sort1 myarray 22 | print $ sort2 myarray 23 | print $ sort3 myarray 24 | -------------------------------------------------------------------------------- /www/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: black; 3 | font-family: 'Marvel', sans-serif; 4 | font-size: 18px; 5 | color: #00cc00; 6 | margin: auto 0px; 7 | } 8 | 9 | a { padding: 3px; 10 | text-decoration: none; color: green; border-bottom: solid #005500 2px } 11 | a:link {text-decoration: none; color: green} 12 | a:visited {text-decoration: none; color: green} 13 | a:active {text-decoration: none; color: #00ff00} 14 | a:hover {text-decoration: none; color: #00ff00} 15 | 16 | #wrapper { 17 | font-size: 18px; 18 | margin-left: auto; 19 | margin-right: auto; 20 | margin-top: 130px; 21 | display: block; 22 | padding: 20px; 23 | width: 90%; 24 | } 25 | 26 | h1 { font-family: "Geostar Fill", cursive; font-size: 36px;} 27 | p { padding: 10px; } 28 | -------------------------------------------------------------------------------- /cpp/boost/bind.cc: -------------------------------------------------------------------------------- 1 | #include "boost/bind.hpp" 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | using boost::bind; 7 | 8 | class MyClass { 9 | public: 10 | void MemberFunction(int num) { 11 | cout << "Member function: " << num << endl; 12 | } 13 | }; 14 | 15 | void FreeFunction(int num) { 16 | cout << "Free function: " << num << endl; 17 | } 18 | 19 | int FreeWithReturn(int num) { 20 | cout << "Free with return: " << num << endl; 21 | return num + 1; 22 | } 23 | 24 | int main() { 25 | (bind(&FreeFunction, _1)) (45); 26 | 27 | MyClass me; 28 | (bind(&MyClass::MemberFunction, _1, _2)) (&me, 50); 29 | 30 | int returned = (bind(&FreeWithReturn, _1)) (45); 31 | cout << "Returned: " << returned << endl; 32 | } 33 | -------------------------------------------------------------------------------- /haskell/euler10.hs: -------------------------------------------------------------------------------- 1 | -- Project Euler: Problem 10 2 | -- Author: Mohit Muthanna Cheppudira 3 | -- 4 | -- Calculate the sum of all the primes below two million. 5 | 6 | import System (getArgs) 7 | 8 | -- Memoized prime number generator. 9 | primes :: Integral a => [a] 10 | primes = 3 : 5 : filter (not . hasFactor) [7,9..] 11 | where hasFactor n = any (divides n) $ takeWhile (<= lowestFactor n) primes 12 | divides n m = n `mod` m == 0 13 | lowestFactor = ceiling . sqrt . fromIntegral 14 | 15 | euler10 :: Int -> Int 16 | euler10 limit = sum $ takeWhile (< limit) (primes :: [Int]) 17 | 18 | main :: IO () 19 | main = do 20 | a <- getArgs 21 | print $ euler10 $ defaultArg a 2000000 22 | where defaultArg a b = if length a == 0 then b else read $ a !! 0 23 | -------------------------------------------------------------------------------- /asm/hello64.asm: -------------------------------------------------------------------------------- 1 | global _start 2 | 3 | ; 4 | ; CONSTANTS 5 | ; 6 | SYS_WRITE equ 1 7 | SYS_EXIT equ 60 8 | STDOUT equ 1 9 | 10 | ; 11 | ; Initialised data goes here 12 | ; 13 | SECTION .data 14 | hello db "Hello World!", 10 ; char * 15 | hello_len equ $-hello ; size_t 16 | 17 | ; 18 | ; Code goes here 19 | ; 20 | SECTION .text 21 | 22 | _start: 23 | ; syscall(SYS_WRITE, STDOUT, hello, hello_len); 24 | mov rax, SYS_WRITE 25 | mov rdi, STDOUT 26 | mov rsi, hello 27 | mov rdx, hello_len 28 | syscall 29 | push rax 30 | 31 | ; syscall(SYS_EXIT, - hello_len); 32 | mov rax, SYS_EXIT 33 | pop rdi 34 | sub rdi, hello_len 35 | syscall 36 | -------------------------------------------------------------------------------- /js/denorun.ts: -------------------------------------------------------------------------------- 1 | import { add } from "./denolib.ts"; 2 | import chalk from "npm:chalk@5.3"; 3 | 4 | // deno run --allow-all denorun.ts 5 | 6 | // deno run --allow-net="deno.com" ... 7 | async function _dumpSite(site: string) { 8 | const res = await fetch(site); // https://deno.com 9 | const body = await res.text(); 10 | 11 | console.log(body); 12 | } 13 | 14 | function adder() { 15 | console.log(add(1, 2)); 16 | } 17 | 18 | // deno run --allow-env ... 19 | function env() { 20 | console.log(Deno.env.get("HOME")); 21 | } 22 | 23 | // deno run --allow-all ... 24 | function hello_color() { 25 | // Seems like you need --allow-all for terminal colors to work 26 | console.log(chalk.green("Hello"), chalk.blue("World!")); 27 | } 28 | 29 | adder(); 30 | env(); 31 | hello_color(); 32 | -------------------------------------------------------------------------------- /www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web Audio Tone Generator 5 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |

0xFE

14 | home 15 |     16 | blog 17 |     18 | code 19 |     20 | plus 21 |
22 |
23 | 24 | 25 | -------------------------------------------------------------------------------- /asm/old/disasm.s: -------------------------------------------------------------------------------- 1 | .text 2 | .globl _show 3 | _show: 4 | pushl %ebp 5 | movl %esp, %ebp 6 | subl $24, %esp 7 | movl 8(%ebp), %eax 8 | movl %eax, (%esp) 9 | call L_printf$stub 10 | leave 11 | ret 12 | .cstring 13 | LC0: 14 | .ascii "Hello World\12\0" 15 | .text 16 | .globl _main 17 | _main: 18 | pushl %ebp 19 | movl %esp, %ebp 20 | pushl %ebx 21 | subl $20, %esp 22 | call L5 23 | "L00000000001$pb": 24 | L5: 25 | popl %ebx 26 | leal LC0-"L00000000001$pb"(%ebx), %eax 27 | movl %eax, (%esp) 28 | call _show 29 | movl $0, %eax 30 | addl $20, %esp 31 | popl %ebx 32 | leave 33 | ret 34 | .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 35 | L_printf$stub: 36 | .indirect_symbol _printf 37 | hlt ; hlt ; hlt ; hlt ; hlt 38 | .subsections_via_symbols 39 | -------------------------------------------------------------------------------- /emdr/webpack.config.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require("html-webpack-plugin"); 2 | const path = require('path'); 3 | 4 | module.exports = { 5 | entry: './src/index.ts', 6 | module: { 7 | rules: [ 8 | { test: /\.ts?$/, use: 'ts-loader', exclude: /node_modules/, }, 9 | { test: /\.css$/, use: ['style-loader', 'css-loader'] }, 10 | ], 11 | }, 12 | resolve: { 13 | extensions: ['.tsx', '.ts', '.js'], 14 | }, 15 | output: { 16 | filename: 'bundle.js', 17 | path: path.resolve(__dirname, 'dist'), 18 | }, 19 | devServer: { 20 | static: path.join(__dirname, "dist"), 21 | compress: true, 22 | port: 4000, 23 | }, 24 | plugins: [ 25 | new HtmlWebpackPlugin({ 26 | title: 'Remote EMDR', 27 | template: 'index.html' }) 28 | ], 29 | }; -------------------------------------------------------------------------------- /python/webapp/models/api.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | # 3 | # Install sqlalchemy with easy_install or ports. 4 | 5 | from sqlalchemy import create_engine 6 | from sqlalchemy.orm import sessionmaker 7 | 8 | from models.metadata import metadata 9 | from models import user 10 | 11 | class APIFactory(object): 12 | log_sql = False 13 | 14 | def __init__(self): 15 | self.initialize_engine() 16 | self.metadata = metadata 17 | self.Session = sessionmaker(bind=self.engine) 18 | self.session = self.Session() 19 | 20 | def initialize_engine(self): 21 | self.engine = create_engine('sqlite:///:memory:', echo=self.log_sql) 22 | 23 | def create_tables(self): 24 | self.metadata.create_all(self.engine) 25 | 26 | def get_user_api(self): 27 | return user.API(self.session) 28 | -------------------------------------------------------------------------------- /minikube/helm/dice/templates/ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: {{ .Values.app_prefix }}-main-ingress 5 | annotations: 6 | nginx.ingress.kubernetes.io/rewrite-target: / 7 | spec: 8 | rules: 9 | - host: "{{ .Values.ingressHost }}" 10 | http: 11 | paths: 12 | - path: / 13 | pathType: Prefix 14 | backend: 15 | service: 16 | name: {{ .Values.app_prefix }}-main-service 17 | port: 18 | number: {{ .Values.main.port }} 19 | - path: /server 20 | pathType: Prefix 21 | backend: 22 | service: 23 | name: {{ .Values.app_prefix }}-server-service 24 | port: 25 | number: {{ .Values.server.port }} -------------------------------------------------------------------------------- /rust/hype/src/status.rs: -------------------------------------------------------------------------------- 1 | type Code<'a> = (u16, &'a str); 2 | 3 | pub const OK: Code = (200, "OK"); 4 | pub const NOT_FOUND: Code = (404, "NOT FOUND"); 5 | pub const SERVER_ERROR: Code = (500, "SERVER ERROR"); 6 | 7 | #[derive(Debug, Clone, Eq, PartialEq)] 8 | pub struct Status<'a> { 9 | pub code: u16, 10 | pub text: &'a str, 11 | } 12 | 13 | pub fn from(c: Code) -> Status { 14 | Status { 15 | code: c.0, 16 | text: c.1, 17 | } 18 | } 19 | 20 | #[cfg(test)] 21 | mod tests { 22 | use super::*; 23 | 24 | #[test] 25 | fn it_works() { 26 | assert_eq!(from(OK).code, 200); 27 | assert_eq!(from(OK).text, "OK"); 28 | } 29 | 30 | #[test] 31 | fn it_works_with_var() { 32 | let code = from(NOT_FOUND); 33 | assert_eq!(code.code, 404); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /python/challenges/merge_intervals.py: -------------------------------------------------------------------------------- 1 | # https://leetcode.com/problems/merge-intervals/ 2 | 3 | 4 | def merge(intervals: list[list[int]]) -> list[list[int]]: 5 | if len(intervals) < 2: 6 | return intervals 7 | 8 | answer = [] 9 | intervals.sort(key=lambda v: v[0]) 10 | 11 | low, high = intervals[0] 12 | for r in intervals[1:]: 13 | if r[0] > high: 14 | answer.append([low, high]) 15 | low, high = r[0], r[1] 16 | elif r[0] >= low and r[1] > high: 17 | high = r[1] 18 | 19 | answer.append([low, high]) 20 | return answer 21 | 22 | 23 | assert merge([[1, 3], [2, 6], [8, 10], [15, 18]]) == [[1, 6], [8, 10], [15, 18]] 24 | assert merge([[2, 6], [1, 3], [1, 2], [8, 10], [15, 18]]) == [[1, 6], [8, 10], [15, 18]] 25 | assert merge([[1, 3]]) == ([[1, 3]]) 26 | -------------------------------------------------------------------------------- /haskell/LineServerTest.hs: -------------------------------------------------------------------------------- 1 | import Control.Concurrent.MVar 2 | import System.IO 3 | 4 | import LineServer 5 | 6 | data State = State 7 | { payload :: String 8 | , counter :: MVar Int } 9 | 10 | myConnectHandler h = do 11 | putStrLn "New connection" 12 | hPutStrLn h "HELLO" 13 | 14 | myLineHandler state h line = do 15 | let ctrMVar = counter state 16 | ctr <- modifyMVar ctrMVar (\c -> return (c + 1, c)) 17 | hPutStrLn h $ (payload state) ++ " [" ++ (show ctr) ++ "] : " ++ line 18 | 19 | myErrHandler errMsg = putStrLn $ "Connection closed: " ++ errMsg 20 | 21 | main = do 22 | ctr <- newMVar 0 23 | 24 | h <- LineServer.init $ Options 25 | { port = "10000" 26 | , connectHandler = myConnectHandler 27 | , lineHandler = (myLineHandler (State "hsterm" ctr)) 28 | , errHandler = myErrHandler } 29 | 30 | start h 31 | -------------------------------------------------------------------------------- /haskell/renamer.hs: -------------------------------------------------------------------------------- 1 | -- Requires PCRE 2 | -- 3 | -- cabal install regex-pcre 4 | 5 | import Control.Applicative 6 | import Control.Monad 7 | import Data.List 8 | import System 9 | import System.Posix.Directory 10 | import System.Posix.Files 11 | import Text.Regex.PCRE 12 | 13 | ls :: String -> IO ExitCode 14 | ls params = system $ "ls " ++ params 15 | 16 | getDirEntries :: FilePath -> IO [FilePath] 17 | getDirEntries dir = openDirStream dir >>= start 18 | where start s = readDirStream s >>= rest s 19 | rest s "" = return [] 20 | rest s entry = liftM (entry:) (start s) 21 | 22 | main :: IO () 23 | main = do 24 | if length args < 2 25 | then putStrLn "Usage: renamer dir match" 26 | else do 27 | files <- getDirEntries $ args !! 0 28 | let matches = filter (=~ (args !! 1)) files 29 | print matches 30 | -------------------------------------------------------------------------------- /android/CounterService/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello World, PagerServiceManager! 4 | PagerService 5 | Service Started. 6 | Service Stopped. 7 | Service Label. 8 | App/Service/Local Service Controller 9 | This demonstrates how you can implement persistent services that 10 | may be started and stopped as desired. 11 | Start Service 12 | Stop Service 13 | 14 | 15 | -------------------------------------------------------------------------------- /rust/hello/src/structs.rs: -------------------------------------------------------------------------------- 1 | struct Color { 2 | r: u8, 3 | g: u8, 4 | b: u8 5 | } 6 | 7 | impl Color { 8 | fn new(r: u8, g: u8, b: u8) -> Color { 9 | Color{r: r, g: g, b: b} 10 | } 11 | 12 | fn css(&self) -> String { 13 | format!("#{:02x}{:02x}{:02x}", self.r, self.g, self.b) 14 | } 15 | 16 | fn set_r(&mut self, v: u8) { 17 | self.r = v; 18 | } 19 | } 20 | 21 | pub fn run() { 22 | let c = Color{r: 5, g: 6, b: 7}; 23 | println!("{} {} {}", c.r, c.g, c.b); 24 | 25 | // Tuple Struct 26 | struct OtherColor(u8, u8, u8); 27 | let uc = OtherColor(4, 5, 6); 28 | println!("{} {} {}", uc.0, uc.1, uc.1); 29 | 30 | let mut mycolor = Color::new(25, 68, 230); 31 | println!("{}", mycolor.css()); 32 | 33 | mycolor.set_r(200); 34 | println!("{}", mycolor.css()); 35 | } -------------------------------------------------------------------------------- /js/notify.js: -------------------------------------------------------------------------------- 1 | // Requires jQuery 2 | 3 | function Notifier() {} 4 | 5 | // Request permission for this page to send notifications. If allowed, 6 | // calls function "cb" with true. 7 | Notifier.prototype.RequestPermission = function(cb) { 8 | window.webkitNotifications.requestPermission(function() { 9 | if (window.webkitNotifications.checkPermission() == 0) { 10 | return true; 11 | } 12 | }); 13 | } 14 | 15 | // Popup a notification with icon, title, and body. Returns false if 16 | // permission was not granted. 17 | Notifier.prototype.Notify = function(icon, title, body) { 18 | if (window.webkitNotifications.checkPermission() == 0) { 19 | var popup = window.webkitNotifications.createNotification( 20 | icon, title, body); 21 | popup.show(); 22 | 23 | return true; 24 | } 25 | 26 | return false; 27 | } 28 | -------------------------------------------------------------------------------- /python/readline_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import readline 4 | 5 | class Completer: 6 | def __init__(self, words): 7 | self.words = words 8 | self.prefix = None 9 | 10 | def complete(self, prefix, index): 11 | if prefix != self.prefix: 12 | self.matching_words = [ w for w in self.words if w.startswith(prefix) ] 13 | self.prefix = prefix 14 | try: 15 | return self.matching_words[index] 16 | except IndexError: 17 | return None 18 | 19 | 20 | words = ["stuff", "others", "me", "monkeys", "othello"] 21 | completer = Completer(words) 22 | 23 | readline.parse_and_bind("tab: complete") 24 | readline.set_completer(completer.complete) 25 | 26 | line = "" 27 | 28 | while line != "q": 29 | line = raw_input("> ") 30 | 31 | if line == "?": 32 | print "q: quit" 33 | else: 34 | print line 35 | -------------------------------------------------------------------------------- /minikube/client/cmd/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "0xfe/experiments/minikube/client" 5 | "flag" 6 | "fmt" 7 | "log" 8 | ) 9 | 10 | var flagTarget = flag.String("target", "localhost:3001", "server address:port") 11 | 12 | func main() { 13 | flag.Parse() 14 | log.Printf("connecting to %s...\n", *flagTarget) 15 | 16 | client := client.NewClient(*flagTarget) 17 | defer client.Close() 18 | 19 | client.Roll("foobar") 20 | client.Roll("foobar") 21 | client.Roll("foobar") 22 | client.Roll("0xfe") 23 | client.Roll("0xfe") 24 | 25 | ch, err := client.GetRolls() 26 | if err != nil { 27 | log.Fatalf("failed: %+v", err) 28 | } 29 | 30 | for rt := range ch { 31 | fmt.Printf("handle: %v\n", rt.RollerHandle) 32 | for i, roll := range rt.Rolls { 33 | fmt.Printf(" roll %d: %v (%d)\n", i+1, roll.Face, roll.Id) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /asm/lib.asm: -------------------------------------------------------------------------------- 1 | ; sum list of integers in arguments 2 | 3 | global atoi, strlen 4 | section .text 5 | 6 | atoi: 7 | push rbp 8 | mov rbp, rsp 9 | 10 | mov r9, 10 ; power of 10 for mul 11 | mov rcx, 0 12 | xor rax, rax 13 | 14 | atoi_loop: 15 | movzx rsi, byte [rdi+rcx] 16 | cmp rsi, 0 17 | je atoi_done 18 | 19 | cmp rsi, 48 20 | jl atoi_done 21 | 22 | cmp rsi, 57 23 | jg atoi_done 24 | 25 | sub rsi, 48 26 | mul r9 27 | add rax, rsi 28 | inc rcx 29 | jmp atoi_loop 30 | 31 | atoi_done: 32 | leave 33 | ret 34 | 35 | 36 | strlen: 37 | push rbp 38 | mov rbp, rsp 39 | mov rcx, 0 40 | 41 | strlen_count: 42 | cmp [rdi+rcx], byte 0 43 | je strlen_done 44 | inc rcx 45 | jmp strlen_count 46 | 47 | strlen_done: 48 | mov rax, rcx 49 | leave 50 | ret 51 | -------------------------------------------------------------------------------- /python/hellomac.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from Tkinter import * 4 | 5 | class Application(Frame): 6 | def say_hi(self): 7 | print "hi there, everyone!" 8 | 9 | def createWidgets(self): 10 | self.QUIT = Button(self) 11 | self.QUIT["text"] = "QUIT" 12 | self.QUIT["fg"] = "red" 13 | self.QUIT["command"] = self.quit 14 | 15 | self.QUIT.pack({"side": "left"}) 16 | 17 | self.hi_there = Button(self) 18 | self.hi_there["text"] = "Hello", 19 | self.hi_there["command"] = self.say_hi 20 | 21 | self.hi_there.pack({"side": "left"}) 22 | 23 | def __init__(self, master=None): 24 | Frame.__init__(self, master) 25 | self.pack() 26 | self.createWidgets() 27 | 28 | root = Tk() 29 | app = Application(master=root) 30 | app.mainloop() 31 | root.destroy() 32 | -------------------------------------------------------------------------------- /haskell/unlines.hs: -------------------------------------------------------------------------------- 1 | import System.Environment (getArgs) 2 | 3 | splitLines [] = [] 4 | splitLines cs = 5 | let (pre, suf) = break isNewLine cs 6 | in pre : case suf of 7 | ('\r':'\n':rest) -> splitLines rest 8 | ('\r':rest) -> splitLines rest 9 | ('\n':rest) -> splitLines rest 10 | _ -> [] 11 | 12 | isNewLine c = c == '\r' || c == '\n' 13 | 14 | interactWith function inputFile outputFile = do 15 | input <- readFile inputFile 16 | writeFile outputFile (function input) 17 | 18 | fixLines input = unlines (splitLines input) 19 | 20 | main = mainWith myFunction 21 | where mainWith function = do 22 | args <- getArgs 23 | case args of 24 | [input, output] -> interactWith function input output 25 | _ -> putStrLn "error: two arguments needed" 26 | 27 | myFunction = fixLines 28 | -------------------------------------------------------------------------------- /rust/hello/src/lifetimes.rs: -------------------------------------------------------------------------------- 1 | fn gt<'a>(a: &'a str, b: &'a str) -> &'a str { 2 | if a > b { 3 | a 4 | } else { 5 | b 6 | } 7 | } 8 | 9 | pub fn run() { 10 | // Stack allocated int 11 | let a = 5; 12 | 13 | // Copy 14 | let b = a; 15 | 16 | // This is fine 17 | println!("{} {}", a, b); 18 | 19 | // Heap allocated int 20 | let a = Box::new(5); 21 | 22 | // This changes ownership of the int from a to b 23 | let b = a; 24 | 25 | // This won't complile because a is invalid. 26 | // println!("{} {}", a, b); 27 | 28 | // You can clone it instead. (Note b is still the owner, so clone from b) 29 | let c = b.clone(); 30 | 31 | // This is fine 32 | println!("{} {}", b, c); 33 | 34 | println!("gt {}", gt("foo", "bar")) 35 | 36 | // b and c are destroyed when they go out of scope 37 | } -------------------------------------------------------------------------------- /python/permute.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from copy import copy 4 | 5 | CHARS = "mohitamrita" 6 | 7 | def perm(length, min, max): 8 | def make_perm(length, num): 9 | perm = [] 10 | for i in range(0, length): 11 | perm.append(num) 12 | 13 | return perm 14 | 15 | def permx(length, min, max, state, perms): 16 | if length == 0: 17 | perms.append(copy(state)) 18 | return perms 19 | 20 | for c in range(min, max + 1): 21 | state[length-1] = c 22 | permx(length-1, min, max, state, perms) 23 | 24 | return perms 25 | 26 | return permx(length, min, max, make_perm(length, 0), []) 27 | 28 | """ 29 | def charperm(chars, perms): 30 | for prm in perms: 31 | char = "" 32 | for p in prm: 33 | char 34 | 35 | for i in range(4, 9): 36 | charperm(CHARS, perm(i, 1, 9)) 37 | """ 38 | 39 | print perm(3, 1, 9) 40 | -------------------------------------------------------------------------------- /haskell/min.hs: -------------------------------------------------------------------------------- 1 | mymin :: (Ord a) => a -> a -> a 2 | mymin a b = if a < b then a 3 | else b 4 | 5 | mymax :: (Ord a) => a -> a -> a 6 | mymax a b = if a > b then a 7 | else b 8 | 9 | minarr :: (Ord a) => [a] -> Maybe a 10 | minarr [] = Nothing 11 | minarr xs = Just $ helper xs 12 | where helper (x : []) = x 13 | helper (x : xs) = mymin x (helper xs) 14 | 15 | minarr2 :: (Ord a) => [a] -> Maybe a 16 | minarr2 [] = Nothing 17 | minarr2 (x : xs) = Just $ foldr mymin x xs 18 | 19 | fromMaybe :: a -> Maybe a -> a 20 | fromMaybe defval Nothing = defval 21 | fromMaybe defval (Just a) = a 22 | 23 | main = do 24 | print $ mymin 4 5 25 | print $ mymax 4 5 26 | print $ fromMaybe (-1) (minarr [12, 4, 5, 76, 3, 4, 4, 8, 43]) 27 | print $ fromMaybe (-1) (minarr2 [12, 4, 5, 76, 3, 4, 4, 8, 43]) 28 | print $ fromMaybe (-1) (minarr2 []) 29 | -------------------------------------------------------------------------------- /emdr/src/index.ts: -------------------------------------------------------------------------------- 1 | import Circle from './circle'; 2 | import Bouncer from './bouncer'; 3 | 4 | import './static/index.css' 5 | 6 | function main() { 7 | const circlebox = document.getElementById( 'circlebox' ); 8 | const width = circlebox.getBoundingClientRect().width; 9 | const bouncer = new Bouncer(new Circle(300, 300, 30).createElement("circlebox")); 10 | bouncer.setBounds(100, width - 100); 11 | 12 | const startstopEl = document.getElementById("startstop") as HTMLButtonElement; 13 | startstopEl.addEventListener("click", function() { 14 | bouncer.toggle(); 15 | startstopEl.innerHTML = bouncer.running ? "Stop" : "Start"; 16 | }); 17 | 18 | const speedEl = document.getElementById("speed") as HTMLInputElement; 19 | speedEl.addEventListener('change', function() { 20 | bouncer.setSpeed(Number(speedEl.value)); 21 | }); 22 | } 23 | 24 | main(); -------------------------------------------------------------------------------- /www/maps.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 23 | 24 | 25 |

Air Quality for UAE

26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /cpp/interview.cpp: -------------------------------------------------------------------------------- 1 | Node* a; 2 | Node* b; 3 | 4 | Node* search (Node* cur, 5 | vector& pathA, 6 | vector& pathB, 7 | vector& curPath) { 8 | if (cur != NULL) { 9 | curPath.push_back(cur); 10 | if (cur == a) { 11 | copy(cur.begin(), cur.end(), pathA.begin()); 12 | } 13 | 14 | if (cur == b) { 15 | copy(cur.begin(), cur.end(), pathB.begin()); 16 | } 17 | 18 | if (pathA.size() > 0 && pathB.size() > 0) { 19 | return compute(pathA, pathB); 20 | } 21 | 22 | Node* answer = search(cur->lchild, pathA, pathB, curPath); 23 | if (ans != NULL) { 24 | return ans; 25 | } 26 | 27 | answer = search(cur->rchild, pathA, pathB, curPath); 28 | if (ans != NULL) { 29 | return ans; 30 | } 31 | 32 | curPath.pop_back(); 33 | 34 | return NULL; 35 | } else return NULL; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /haskell/Test.hs: -------------------------------------------------------------------------------- 1 | module Main 2 | where 3 | 4 | import IO 5 | import Random 6 | 7 | x = 5 8 | y = (6, "hello") 9 | z = x * fst y 10 | 11 | addthem x y = x + y 12 | 13 | run_this = do 14 | putStrLn ("A") 15 | putStrLn ("B") 16 | 17 | getNumbers = do 18 | putStrLn "enter a number: " 19 | word <- getLine 20 | 21 | if read word == 0 22 | then return [] 23 | else do 24 | rest <- getNumbers 25 | return ((read word :: Int ): rest) 26 | 27 | showNumbers [] = return () 28 | showNumbers (x:xs) = do 29 | putStrLn (show x) 30 | showNumbers xs 31 | 32 | my_min :: [a] -> Maybe a 33 | my_min [] = Nothing 34 | my_min (x:xs) = do 35 | min <- read my_min xs 36 | if min < x 37 | then Just min 38 | else Just x 39 | 40 | 41 | main = do 42 | numbers <- getNumbers 43 | showNumbers numbers 44 | putStrLn ("Minimum: ") 45 | 46 | min <- my_min numbers 47 | putStrLn (show min) 48 | -------------------------------------------------------------------------------- /minikube/server.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19 as builder 2 | 3 | # Create and change to the app directory. 4 | WORKDIR /app 5 | 6 | # Copy go.mod and go.sum, then retrieve application dependencies. 7 | # This allows the container build to reuse cached dependencies. 8 | COPY go.* ./ 9 | RUN go mod download 10 | 11 | # Copy local code to the container image. 12 | COPY . ./ 13 | 14 | # Build the binary. 15 | WORKDIR /app/server 16 | RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o main 17 | 18 | # Use the official Alpine image for a lean production container. 19 | # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds 20 | FROM alpine:latest 21 | RUN apk add --no-cache ca-certificates 22 | 23 | # Copy the binary to the production image from the builder stage. 24 | COPY --from=builder /app/server/main /main 25 | 26 | # Run the web service on container startup. 27 | CMD ["/main"] -------------------------------------------------------------------------------- /haskell/picture.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Data.List 4 | 5 | type PictureHeader = String 6 | type PictureBody = [Int] 7 | type Checksum = Int 8 | 9 | data Picture = Picture { 10 | pic_header :: PictureHeader, 11 | pic_body :: PictureBody, 12 | pic_checksum :: Checksum 13 | } deriving Show 14 | 15 | validPic p = 16 | case pic_header p of 17 | "" -> Nothing 18 | _ -> Just "Valid" 19 | 20 | fromMaybe defval wrapped = 21 | case wrapped of 22 | Nothing -> defval 23 | Just value -> value 24 | 25 | main = do 26 | let p = Picture "Hello" [1,2,3] 5 27 | let q = Picture "" [1, 2, 3] 6 28 | 29 | print p 30 | print q 31 | 32 | putStrLn $ "Picture header: " ++ pic_header (p) 33 | 34 | putStrLn $ "Valid: " ++ (fromMaybe "Invalid" $ validPic (p)) 35 | putStrLn $ "Valid: " ++ (fromMaybe "Invalid" $ validPic (q)) 36 | -------------------------------------------------------------------------------- /java/ImageDownloader.java: -------------------------------------------------------------------------------- 1 | import java.net.*; 2 | import java.io.*; 3 | 4 | public class ImageDownloader { 5 | public static void StreamCopier(InputStream in, OutputStream out) throws Exception { 6 | // Stick to 4K page size 7 | byte[] buffer = new byte[4096]; 8 | 9 | while (true) { 10 | int bytesRead = in.read(buffer); 11 | if (bytesRead == -1) break; 12 | out.write(buffer, 0, bytesRead); 13 | } 14 | } 15 | 16 | public ImageDownloader(String location, String fileName) throws Exception { 17 | StreamCopier(new URL(location).openStream(), 18 | new FileOutputStream(fileName)); 19 | } 20 | 21 | public static void main(String[] args) throws Exception { 22 | if (args.length < 2) { 23 | System.out.println("Usage: ImageDownloader URL filename"); 24 | System.exit(0); 25 | } 26 | 27 | new ImageDownloader(args[0], args[1]); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /www/filter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 31 | 32 | 33 | 34 |

Boo

35 | 36 | Play Sine Wave 37 | 38 | 39 | -------------------------------------------------------------------------------- /minikube/server.arm64.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19 as builder 2 | 3 | # Create and change to the app directory. 4 | WORKDIR /app 5 | 6 | # Copy go.mod and go.sum, then retrieve application dependencies. 7 | # This allows the container build to reuse cached dependencies. 8 | COPY go.* ./ 9 | RUN go mod download 10 | 11 | # Copy local code to the container image. 12 | COPY . ./ 13 | 14 | # Build the binary. 15 | WORKDIR /app/server 16 | RUN GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o main 17 | 18 | # Use the official Alpine image for a lean production container. 19 | # https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds 20 | FROM alpine:latest 21 | RUN apk add --no-cache ca-certificates 22 | 23 | # Copy the binary to the production image from the builder stage. 24 | COPY --from=builder /app/server/main /main 25 | 26 | # Run the web service on container startup. 27 | CMD ["/main"] 28 | -------------------------------------------------------------------------------- /emdr/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emdr", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "develop": "webpack-dev-server --mode development", 9 | "build": "webpack --mode production" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "devDependencies": { 15 | "@types/node": "^18.11.18", 16 | "@typescript-eslint/eslint-plugin": "^5.50.0", 17 | "@typescript-eslint/parser": "^5.50.0", 18 | "css-loader": "^6.7.3", 19 | "eslint": "^8.33.0", 20 | "html-webpack-plugin": "^5.5.0", 21 | "prettier": "^2.8.3", 22 | "style-loader": "^3.3.1", 23 | "ts-loader": "^9.4.2", 24 | "typescript": "^4.9.4", 25 | "webpack": "^5.75.0", 26 | "webpack-cli": "^5.0.1", 27 | "webpack-dev-server": "^4.11.1" 28 | }, 29 | "dependencies": { 30 | "axios": "^1.3.2" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /haskell/euler2.hs: -------------------------------------------------------------------------------- 1 | -- Project Euler: Problem 2 2 | -- Author: Mohit Muthanna Cheppudira 3 | -- 4 | -- Each new term in the Fibonacci sequence is generated by adding the previous 5 | -- two terms. By starting with 1 and 2, the first 10 terms will be: 6 | -- 7 | -- 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... 8 | -- 9 | -- Find the sum of all the even-valued terms in the sequence which do not 10 | -- exceed four million. 11 | 12 | import System (getArgs) 13 | 14 | -- Simple memoized Fibonacci sequence 15 | fibs :: [Integer] 16 | fibs = map genFib [0..] 17 | where 18 | genFib 0 = 0 19 | genFib 1 = 1 20 | genFib 2 = 2 21 | genFib x = (fibs !! (x - 1)) + (fibs !! (x - 2)) 22 | 23 | -- Solving Euler 2 for arbitrary limit 24 | euler2 :: Integer -> Integer 25 | euler2 limit = sum $ filter (not . odd) (takeWhile ( int: 19 | if len(nums) == 1: 20 | return nums[0] 21 | 22 | max_so_far = 0 23 | ans = -100000 24 | 25 | for n in nums: 26 | max_so_far += n 27 | 28 | if n > max_so_far: 29 | max_so_far = n 30 | 31 | if max_so_far > ans: 32 | ans = max_so_far 33 | 34 | print("ans", ans) 35 | return ans 36 | 37 | 38 | def test_maxSubArray(): 39 | assert maxSubArray([-2, 1, -3, 4, -1, 2, 1, -5, 4]) == 6 40 | assert maxSubArray([1]) == 1 41 | assert maxSubArray([5, 4, -1, 7, 8]) == 23 42 | assert maxSubArray([5, 4, -1, 7, -8]) == 15 43 | 44 | 45 | test_maxSubArray() 46 | -------------------------------------------------------------------------------- /emdr/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 |

Remote EMDR

10 | 11 | 12 |
13 | 14 | 23 |
24 | 25 | -------------------------------------------------------------------------------- /haskell/logger.hs: -------------------------------------------------------------------------------- 1 | -- Build a logger monad, and use it in an operation 2 | 3 | type Log = [String] 4 | 5 | newtype Logger a = Logger { execLogger :: (a, Log) } 6 | 7 | -- Here runLogger is aliased to execLogger. This works because 8 | -- execLogger is a function that takes a Logger and returns the 9 | -- associated data element: (a, Log). 10 | runLogger :: Logger a -> (a, Log) 11 | runLogger = execLogger 12 | 13 | -- Return nothing, just log the string. 14 | record s = Logger ((), [s]) 15 | 16 | instance Monad Logger where 17 | -- Return a, log nothing 18 | return a = Logger (a, []) 19 | 20 | -- The magic happens here. Execute m then k, and concatenate 21 | -- the associated log message array. 22 | m >>= k = let (a, w) = execLogger m 23 | n = k a 24 | (b, x) = execLogger n 25 | in Logger (b, w ++ x) 26 | 27 | 28 | main = do print $ runLogger $ 29 | do record "Hello World!" 30 | return 3.1337 31 | -------------------------------------------------------------------------------- /java/servlets/beer/etc/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Asterisk Server 5 | server 6 | lonsdale:5050 7 | 8 | 9 | 10 | ServletContextListener 11 | com.test.BeerListener 12 | 13 | 14 | 15 | Beer Servlet 16 | com.test.BeerSelect 17 | 18 | 19 | 20 | Beer Servlet 21 | /SelectBeer.do 22 | 23 | 24 | -------------------------------------------------------------------------------- /android/CounterService/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CounterService 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /ruby/refresher.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: white; 3 | font-family: 'Inika', Arial; 4 | font-size: 12pt; 5 | color: #222222; 6 | margin: auto 20px; 7 | width: 90%; 8 | } 9 | 10 | a { text-decoration: none; color: black; padding-bottom: 3px;} 11 | a:link {text-decoration: none; color: black; 12 | border-bottom: dotted black 2px } 13 | a:visited {text-decoration: none; color: black; 14 | border-bottom: dotted black 2px } 15 | a:active {text-decoration: none; color: black; 16 | border-bottom: dotted red 2px } 17 | a:hover {text-decoration: none; color: black; 18 | border-bottom: dotted red 2px } 19 | 20 | h1 { 21 | color: black; 22 | font-size: 36px; 23 | margin-bottom: 2px; 24 | margin-top: 2px; 25 | } 26 | 27 | pre { 28 | padding: 10px; 29 | padding-left: 20px; 30 | border-left: solid 4px #ccc; 31 | background: #eee; 32 | } 33 | 34 | code { 35 | font-size: 12pt; 36 | font-family: 'Inconsolata', Courier; 37 | } 38 | -------------------------------------------------------------------------------- /go/wscript: -------------------------------------------------------------------------------- 1 | APPNAME = "gohello" 2 | VERSION = "1.0" 3 | 4 | top = "." 5 | out = "build" 6 | 7 | def configure(ctx): 8 | ctx.env.GOC = "6g" 9 | ctx.env.GOL = "6l" 10 | 11 | def build(ctx): 12 | sources = ["echo.go", "hello.go", "slices.go"] 13 | 14 | for file in sources: 15 | # Files with ".go" extensions are automatically compiled and linked 16 | ctx(source=file) 17 | 18 | # Remove .bin extension from file 19 | binary = file.replace(".go", "") 20 | ctx(rule="mv ${SRC} ${TGT}", source=(binary + ".bin"), target=binary) 21 | 22 | """ 23 | Code to automatically compile and link files with ".go" as their extension. 24 | """ 25 | 26 | from waflib import TaskGen 27 | 28 | TaskGen.declare_chain( 29 | name = "goc", 30 | rule = "${GOC} -o ${TGT} ${SRC}", 31 | ext_in = ".go", 32 | ext_out = ".6") 33 | 34 | TaskGen.declare_chain( 35 | name = "gol", 36 | rule = "${GOL} -o ${TGT} ${SRC}", 37 | ext_in = ".6", 38 | ext_out = ".bin", 39 | reentrant = False) 40 | -------------------------------------------------------------------------------- /js/v8/test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace v8; 5 | 6 | int main(int argc, char* argv[]) { 7 | 8 | // Create a stack-allocated handle scope. 9 | HandleScope handle_scope; 10 | 11 | // Create a new context. 12 | Persistent context = Context::New(); 13 | 14 | // Enter the created context for compiling and 15 | // running the hello world script. 16 | Context::Scope context_scope(context); 17 | 18 | // Create a string containing the JavaScript source code. 19 | Handle source = String::New("'Hello' + ', World!'"); 20 | 21 | // Compile the source code. 22 | Handle 8 | 10 | 12 | 14 | 16 | 17 | 19 | 21 | 22 | {% block head %}{% end %} 23 | {% block title %}Vex Title{% end %} 24 | 25 | 26 | 27 |
28 | {% block wrapper %} 29 | {% end %} 30 |
31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /scala/AsteriskClient/Client.scala: -------------------------------------------------------------------------------- 1 | package asterisk.ami 2 | 3 | import java.io._; 4 | import java.net._; 5 | import java.util.Random; 6 | import scala.collection.mutable.Map; 7 | import scala.io.Source; 8 | import scala.util.logging._; 9 | import scala.util.matching.Regex; 10 | 11 | case class ResponseError(val response: Response) extends Exception 12 | class Client(val conn: BaseConnection) { 13 | // Send AMI command to server, and return the response. This will wait 14 | // for the response with the same ActionID as the command. 15 | def sendCommand(command: Command) : Response = { 16 | conn.write(command.mkString) 17 | 18 | var response = Response(conn.readResponse) 19 | while (response.actionid != command.actionid) { 20 | response = Response(conn.readResponse) 21 | } 22 | 23 | response 24 | } 25 | 26 | // Same as sendCommand, except that a ResponseError exception is thrown 27 | // upon error. 28 | def tryCommand(cmd: Command) : Response = { 29 | val resp = sendCommand(cmd) 30 | resp match { 31 | case ami.response.Error(_) => throw ResponseError(resp) 32 | case _ => resp 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/CounterService/res/layout/local_service_controller.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 9 | 10 | 15 | 16 | 21 | 22 | 26 | 27 | -------------------------------------------------------------------------------- /haskell/hexdump.hs: -------------------------------------------------------------------------------- 1 | -- Usage: hexdump 2 | -- Author: Mohit Cheppudira 3 | 4 | import Control.Monad (when) 5 | import Data.Char 6 | import Data.List 7 | import Numeric 8 | import qualified Data.ByteString.Lazy as L 9 | import System.Exit 10 | import System (getArgs) 11 | import Text.Printf 12 | 13 | bytesPerLine = 16 14 | 15 | toHex c = showIntAtBase 16 intToDigit c "" 16 | toHexList = (map $ printf "%02s" . toHex) . L.unpack 17 | 18 | fileToHex path = do 19 | content <- L.readFile path 20 | return $ toHexList content 21 | 22 | formatList 0 _ = error "x < 1" 23 | formatList x [] = [] 24 | formatList x l = h : formatList x t 25 | where (h, t) = splitAt x l 26 | 27 | showWithAddress [] _ = [] 28 | showWithAddress (x:xs) a = prettify : showWithAddress xs (a + bytesPerLine) 29 | where prettify = (toHex a) ++ " " ++ (intercalate " " x) 30 | 31 | showHexFile file = do 32 | hexData <- fileToHex $ file 33 | mapM putStrLn $ showWithAddress (formatList bytesPerLine hexData) 0 34 | 35 | main = do 36 | args <- getArgs 37 | 38 | when (length args /= 1) $ do 39 | putStrLn "Syntax: hexdump " 40 | exitFailure 41 | 42 | showHexFile $ args !! 0 43 | -------------------------------------------------------------------------------- /java/j3d/LoaderInfo3D/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | NCSA Portfolio 3 | 4 | Portfolio is a very useful collection of model loaders, 5 | developed by the now-defunct NCSA Java 3D Group, in a 6 | project led by Steve Pietrowicz (srp@ncsa.uiuc.edu) and 7 | Chris Heistad (chris@heistad.org). 8 | 9 | Neither of those people is working on NCSA Portfolio now. 10 | 11 | Portfolio is used in chapters 16, 18, 19, 24, 27, and 32 12 | of the book: 13 | Killer Game Programming in Java 14 | http://fivedots.coe.psu.ac.th/~ad/jg 15 | 16 | Contact Address: 17 | Dr. Andrew Davison 18 | Dept. of Computer Engineering 19 | Prince of Songkla University 20 | Hat Yai, Songkhla 90112, Thailand 21 | E-mail: ad@fivedots.coe.psu.ac.th 22 | 23 | 24 | -------------------------------------------------- 25 | How to Install 26 | 27 | Read the license agreement in portfolioLicense.txt 28 | (In essence it says that a person is allowed to distribute 29 | NCSA Portfolio as long as he/she isn't charging money 30 | for it.) 31 | 32 | Extract portfolio.jar from the zip file, and place it 33 | in a location suitable for your application. 34 | 35 | --------- 36 | Last updated: 25th February 2006 -------------------------------------------------------------------------------- /java/macbundle/GlassDemo.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSUIElement 6 | 1 7 | LSUIPresentationMode 8 | 4 9 | CFBundleName 10 | GlassDemo 11 | CFBundleVersion 12 | 100.0 13 | CFBundleAllowMixedLocalizations 14 | true 15 | CFBundleExecutable 16 | JavaApplicationStub 17 | CFBundleDevelopmentRegion 18 | English 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleInfoDictionaryVersion 24 | 6.0 25 | CFBundleIconFile 26 | GenericJavaApp.icns 27 | Java 28 | 29 | MainClass 30 | GlassDemo 31 | JVMVersion 32 | 1.5* 33 | ClassPath 34 | $JAVAROOT/ 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /haskell/udpserver.hs: -------------------------------------------------------------------------------- 1 | import Data.Bits 2 | import Network.Socket 3 | import Network.BSD 4 | import Data.List 5 | 6 | type HandlerFunc = SockAddr -> String -> IO () 7 | 8 | getAddress port = do 9 | addressinfos <- addresses 10 | return $ head addressinfos 11 | where addresses = getAddrInfo 12 | (Just (defaultHints {addrFlags = [AI_PASSIVE]})) 13 | Nothing (Just port) 14 | 15 | udpServer :: String -> HandlerFunc -> IO () 16 | udpServer port handlerfunc = withSocketsDo $ 17 | do 18 | serveraddr <- getAddress port 19 | sock <- socket (addrFamily serveraddr) Datagram defaultProtocol 20 | bindSocket sock (addrAddress serveraddr) 21 | procMessages sock 22 | where procMessages sock = 23 | do 24 | (msg, _, addr) <- recvFrom sock 1024 25 | handlerfunc addr msg 26 | procMessages sock 27 | 28 | 29 | plainHandler :: HandlerFunc 30 | plainHandler addr msg = 31 | putStrLn $ "From " ++ show addr ++ ": " ++ msg 32 | 33 | main = do 34 | let portNum = "8888" 35 | serveraddr <- getAddress portNum 36 | putStrLn $ "Listening on " ++ (show $ addrAddress serveraddr) ++ "/udp" 37 | udpServer portNum plainHandler 38 | -------------------------------------------------------------------------------- /python/ml/recommendations.py: -------------------------------------------------------------------------------- 1 | # A dictionary of movie critics and their ratings of a small 2 | # set of movies 3 | critics={'Lisa Rose': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.5, 4 | 'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5, 5 | 'The Night Listener': 3.0}, 6 | 'Gene Seymour': {'Lady in the Water': 3.0, 'Snakes on a Plane': 3.5, 7 | 'Just My Luck': 1.5, 'Superman Returns': 5.0, 'The Night Listener': 3.0, 8 | 'You, Me and Dupree': 3.5}, 9 | 'Michael Phillips': {'Lady in the Water': 2.5, 'Snakes on a Plane': 3.0, 10 | 'Superman Returns': 3.5, 'The Night Listener': 4.0}, 11 | 'Claudia Puig': {'Snakes on a Plane': 3.5, 'Just My Luck': 3.0, 12 | 'The Night Listener': 4.5, 'Superman Returns': 4.0, 13 | 'You, Me and Dupree': 2.5}, 14 | 'Mick LaSalle': {'Lady in the Water': 3.0, 'Snakes on a Plane': 4.0, 15 | 'Just My Luck': 2.0, 'Superman Returns': 3.0, 'The Night Listener': 3.0, 16 | 'You, Me and Dupree': 2.0}, 17 | 'Jack Matthews': {'Lady in the Water': 3.0, 'Snakes on a Plane': 4.0, 18 | 'The Night Listener': 3.0, 'Superman Returns': 5.0, 'You, Me and Dupree': 3.5}, 19 | 'Toby': {'Snakes on a Plane':4.5,'You, Me and Dupree':1.0,'Superman Returns':4.0}} 20 | 21 | 22 | -------------------------------------------------------------------------------- /rust/hello/src/dynamic.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug)] 2 | struct Point(i32, i32); 3 | 4 | #[derive(Debug)] 5 | struct Rect { 6 | tl: Point, 7 | br: Point, 8 | } 9 | 10 | #[derive(Debug)] 11 | struct Circle { 12 | center: Point, 13 | radius: u32, 14 | } 15 | 16 | pub trait Draw { 17 | fn draw(&self); 18 | } 19 | 20 | impl Draw for Rect { 21 | fn draw(&self) { 22 | println!("Drawing rectangle: {:?}", self); 23 | println!("br: {:?} tl: {:?}", self.br, self.tl); 24 | } 25 | } 26 | 27 | impl Draw for Circle { 28 | fn draw(&self) { 29 | println!("Drawing circle: {:?}", self); 30 | println!("center: {:?} radius: {:?}", self.center, self.radius); 31 | } 32 | } 33 | 34 | pub fn draw_all(shapes: &Vec>) { 35 | for shape in shapes { 36 | shape.draw(); 37 | } 38 | } 39 | 40 | pub fn run() { 41 | let circle = Box::new(Circle { 42 | center: Point(100, 100), 43 | radius: 10, 44 | }); 45 | 46 | let rect = Box::new(Rect { 47 | tl: Point(0, 0), 48 | br: Point(100, 100), 49 | }); 50 | 51 | let shapes: Vec> = vec![circle, rect]; 52 | 53 | draw_all(&shapes); 54 | } 55 | -------------------------------------------------------------------------------- /cpp/casting.cc: -------------------------------------------------------------------------------- 1 | // Author: mmuthanna@google.com (Mohit Cheppudira) 2 | 3 | #include 4 | class Object{ 5 | public: 6 | virtual int Hash() {return (int)this;} 7 | }; 8 | class A:public Object{ 9 | public: 10 | int x; 11 | A(){x=1;} 12 | }; 13 | class B:public Object{ 14 | public: 15 | int y; 16 | B(){y=2;} 17 | }; 18 | class C:public A,public B{ 19 | public: 20 | int z; 21 | C() {z=3;} 22 | }; 23 | 24 | void blah (Object * reallyC) { 25 | C* cP = dynamic_cast(reallyC); 26 | printf ("cP.x: %d cP.y: %d\n",cP->x,cP->y); 27 | } 28 | 29 | int main () { 30 | C * c= new C; 31 | A * aP=c; 32 | B * bP=c; 33 | printf ("aP.x %d bP.y: %d\n",aP->x ,bP->y); 34 | { 35 | C * cP=(C*)(void*)aP; 36 | printf ("cP.x: %d cP.y: %d\n",cP->x,cP->y); 37 | } 38 | C * cP=(C*)(void*)bP; 39 | printf ("cP.x: %d cP.y: %d\n",cP->x,cP->y); 40 | C * cPgood= (C*)bP; 41 | printf ("dyncP.x: %d dyncP.y: %d\n",cPgood->x, cPgood->y); 42 | 43 | printf("%d\n", aP->Hash()); 44 | printf("%d\n", bP->Hash()); 45 | printf("%d\n", c->A::Hash()); 46 | printf("%d\n", c->B::Hash()); 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /java/xmpp/SmackTest.java: -------------------------------------------------------------------------------- 1 | import org.jivesoftware.smack.*; 2 | import org.jivesoftware.smack.packet.*; 3 | import java.io.*; 4 | import java.util.logging.*; 5 | 6 | class SmackTest { 7 | private static Logger logger = Logger.global; 8 | 9 | public static void main(String[] args) { 10 | logger.setLevel(Level.INFO); 11 | ConnectionConfiguration config = 12 | new ConnectionConfiguration("talk.google.com", 5222, "gmail.com"); 13 | 14 | XMPPConnection connection = new XMPPConnection(config); 15 | 16 | BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); 17 | 18 | try { 19 | System.out.print("Username: "); 20 | String username = in.readLine(); 21 | 22 | System.out.print("Password: " ); 23 | String password = in.readLine(); 24 | 25 | connection.connect(); 26 | connection.login(username, password); 27 | 28 | Presence presence = new Presence(Presence.Type.available); 29 | connection.sendPacket(presence); 30 | } catch (XMPPException ex) { 31 | logger.severe("Connection failed: " + ex); 32 | } catch (IOException ex) { 33 | logger.severe("Failed to get credentials: " + ex); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /rust/hello/src/asyncawait.rs: -------------------------------------------------------------------------------- 1 | use async_std::task; 2 | use futures::executor::block_on; 3 | use std::time; 4 | 5 | async fn part1() -> usize { 6 | for n in 1..10 { 7 | // Notice this is async_std::task::sleep and not thread::sleep. Also 8 | // notice the await. You need to use async-aware blocking methods wherever 9 | // possible. 10 | task::sleep(time::Duration::from_millis(100)).await; 11 | println!("a - {}", n); 12 | } 13 | 14 | 1 15 | } 16 | 17 | async fn part2() -> usize { 18 | for n in 1..10 { 19 | task::sleep(time::Duration::from_millis(50)).await; 20 | println!("b - {}", n); 21 | } 22 | 23 | 2 24 | } 25 | 26 | async fn go() { 27 | let (a, b) = futures::join!(part1(), part2()); 28 | println!("a: {}, b: {}", a, b); 29 | } 30 | 31 | async fn fetch() { 32 | /* 33 | // Needs Tokio to work. 34 | use reqwest; 35 | 36 | let body = reqwest::get("http://www.rust-lang.org") 37 | .await 38 | .unwrap() 39 | .text() 40 | .await 41 | .unwrap(); 42 | println!("Rust body:\n{}", body) 43 | */ 44 | } 45 | 46 | pub fn run() { 47 | block_on(go()); 48 | block_on(fetch()); 49 | } 50 | -------------------------------------------------------------------------------- /cpp/casting_virtual.cc: -------------------------------------------------------------------------------- 1 | // Author: mmuthanna@google.com (Mohit Cheppudira) 2 | 3 | 4 | #include 5 | class Object{ 6 | public: 7 | virtual int Hash() {return (int)this;} 8 | }; 9 | class A:virtual public Object{ 10 | public: 11 | int x; 12 | A(){x=1;} 13 | }; 14 | class B:virtual public Object{ 15 | public: 16 | int y; 17 | B(){y=2;} 18 | }; 19 | class C:public A,public B{ 20 | public: 21 | int z; 22 | C() {z=3;} 23 | }; 24 | 25 | void blah (Object * reallyC) { 26 | C* cP = dynamic_cast(reallyC); 27 | printf ("cP.x: %d cP.y: %d\n",cP->x,cP->y); 28 | } 29 | 30 | int main () { 31 | C * c= new C; 32 | A * aP=c; 33 | B * bP=c; 34 | printf ("aP.x %d bP.y: %d\n",aP->x ,bP->y); 35 | { 36 | C * cP=(C*)(void*)aP; 37 | printf ("cP.x: %d cP.y: %d\n",cP->x,cP->y); 38 | } 39 | C * cP=(C*)(void*)bP; 40 | printf ("cP.x: %d cP.y: %d\n",cP->x,cP->y); 41 | C * cPgood= (C*)bP; 42 | printf ("dyncP.x: %d dyncP.y: %d\n",cPgood->x, cPgood->y); 43 | 44 | printf("%d\n", aP->Hash()); 45 | printf("%d\n", bP->Hash()); 46 | printf("%d\n", c->A::Hash()); 47 | printf("%d\n", c->B::Hash()); 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /python/webapp/model_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.7 2 | 3 | import unittest 4 | from sqlalchemy import create_engine 5 | from sqlalchemy.orm import mapper, sessionmaker 6 | 7 | from vexweb.db import ValidationError 8 | from models.api import APIFactory 9 | 10 | class MockAPIFactory(APIFactory): 11 | def initialize_engine(self): 12 | self.engine = create_engine('sqlite:///:memory:', echo=False) 13 | 14 | class TestUserAPI(unittest.TestCase): 15 | def setUp(self): 16 | api = MockAPIFactory() 17 | api.create_tables() 18 | self.user_api = api.get_user_api() 19 | 20 | def test_add_user(self): 21 | self.user_api.add_user(email="a@b.com", password="abc", name="Mo") 22 | self.assertRaises(ValidationError, self.user_api.add_user, 23 | email="a@b.com", password="abc") 24 | self.assertRaises(ValidationError, self.user_api.add_user, email="b@b.com") 25 | 26 | def test_update_user(self): 27 | self.user_api.add_user(email="a@b.com", password="abc", name="Mo") 28 | self.user_api.update_user(email="a@b.com", password="p4ssword") 29 | self.assertRaises(ValidationError, self.user_api.update_user, 30 | email="b@b.com", password="p4") 31 | 32 | if __name__ == '__main__': 33 | unittest.main() 34 | -------------------------------------------------------------------------------- /python/combwords.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # perm.py - print all possible permutations of a word 4 | # 5 | # Copyright 2009 Tobias Klauser 6 | # 7 | # "THE BEER-WARE LICENSE" (Revision 42): 8 | # wrote this file. As long as you retain this notice you 9 | # can do whatever you want with this stuff. If we meet some day, and you think 10 | # this stuff is worth it, you can buy me a beer in return 11 | # Tobias Klauser 12 | 13 | 14 | from __future__ import generators 15 | import sys, os 16 | 17 | def usage(): 18 | print "usage: %s WORD..." % (os.path.basename(sys.argv[0])) 19 | 20 | def xcombinations(items, n): 21 | if n==0: 22 | yield [] 23 | else: 24 | for i in xrange(len(items)): 25 | for cc in xcombinations(items[:i] + items[i+1:], n-1): 26 | yield [items[i]] + cc 27 | 28 | def xpermutations(items): 29 | return xcombinations(items, len(items)) 30 | 31 | def main(): 32 | 33 | if len(sys.argv[1:]) < 1: 34 | usage() 35 | 36 | for w in sys.argv[1:]: 37 | print "Permutations of %s:" % w 38 | for p in xpermutations(w): print " %s" % ''.join(p) 39 | 40 | if __name__=="__main__": 41 | main() 42 | 43 | -------------------------------------------------------------------------------- /scala/YamlReader.scala: -------------------------------------------------------------------------------- 1 | package com.muthanna.playground.scala 2 | 3 | import org.yaml.snakeyaml._ 4 | import java.util.{Map => JavaMap} 5 | import java.util.{HashMap => JavaHashMap} 6 | 7 | // To build and run: 8 | // 9 | // $ fsc -cp support/snakeyaml/* YamlReader.scala 10 | // $ scala -cp support/snakeyaml/*:. com.muthanna.playground.YamlReader 11 | 12 | object Converter { 13 | def toJavaHashMap[T, U](map: Map[T,U]): JavaHashMap[T,U] = { 14 | var javamap = new JavaHashMap[T,U] 15 | for ((k, v) <- map) { 16 | javamap.put(k, v) 17 | } 18 | 19 | javamap 20 | } 21 | 22 | def toJavaMap[M[K, V] <: JavaMap[K, V], K, V]( 23 | map: Map[K,V], javamap: M[K, V]): M[K, V] = { 24 | for ((k, v) <- map) { 25 | javamap.put(k, v) 26 | } 27 | 28 | javamap 29 | } 30 | } 31 | 32 | object YamlReader { 33 | def main(args: Array[String]) { 34 | var yaml = new Yaml 35 | var data = yaml.load("a: 1\nb: 2\n") 36 | 37 | println(data) 38 | 39 | var map: Map[String, Int] = Map("a" -> 1, "b" -> 5) 40 | println(yaml.dump(Converter.toJavaHashMap(map))) 41 | 42 | // var javamap: JavaHashMap[String, Int] = new JavaHashMap 43 | // println(yaml.dump(Converter.toJavaMap(map, javamap))) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /minikube/helm/dice/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: dice 3 | description: A Helm chart for Kubernetes 4 | 5 | # A chart can be either an 'application' or a 'library' chart. 6 | # 7 | # Application charts are a collection of templates that can be packaged into versioned archives 8 | # to be deployed. 9 | # 10 | # Library charts provide useful utilities or functions for the chart developer. They're included as 11 | # a dependency of application charts to inject those utilities and functions into the rendering 12 | # pipeline. Library charts do not define any templates and therefore cannot be deployed. 13 | type: application 14 | 15 | # This is the chart version. This version number should be incremented each time you make changes 16 | # to the chart and its templates, including the app version. 17 | # Versions are expected to follow Semantic Versioning (https://semver.org/) 18 | version: 0.1.2 19 | 20 | # This is the version number of the application being deployed. This version number should be 21 | # incremented each time you make changes to the application. Versions are not expected to 22 | # follow Semantic Versioning. They should reflect the version the application is using. 23 | # It is recommended to use it with quotes. 24 | appVersion: "1.16.0" 25 | -------------------------------------------------------------------------------- /java/AdviceGuy.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.net.*; 3 | 4 | public class AdviceGuy { 5 | String[] adviceList = { 6 | "Take smaller bites", 7 | "One word: inappropriate", 8 | "Just for today, be honest. Lie tomorrow", 9 | "You might want to rethink that haircut" 10 | }; 11 | 12 | boolean running = true; 13 | 14 | public void go() { 15 | try { 16 | ServerSocket s = new ServerSocket(4242); 17 | 18 | while (running) { 19 | Socket sock = s.accept(); 20 | new Thread(new AdvisorThread(sock)).start(); 21 | } 22 | } catch (IOException ex) { 23 | ex.printStackTrace(); 24 | } 25 | } 26 | 27 | public class AdvisorThread implements Runnable { 28 | Socket sock; 29 | 30 | public AdvisorThread(Socket s) { 31 | sock = s; 32 | } 33 | 34 | public void run() { 35 | try { 36 | PrintWriter writer = new PrintWriter(sock.getOutputStream()); 37 | writer.println(adviceList[(int) (Math.random() * adviceList.length)]); 38 | writer.close(); 39 | } catch (IOException ex) { 40 | ex.printStackTrace(); 41 | } 42 | } 43 | } 44 | 45 | 46 | public static void main(String[] args) { 47 | new AdviceGuy().go(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /rust/hello/src/iterators.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | fn iterate() -> Vec { 4 | let v = vec![5, 4, 2, 1]; 5 | 6 | for i in &v { 7 | println!("v {i}"); 8 | } 9 | 10 | let mut total: i32 = v.iter().sum(); 11 | println!("sum: {total}"); 12 | 13 | // map() creates a new iterator, and because iterators are lazily evaluated, 14 | // you need to call collect() on it to iterate through and create a new vector. 15 | let n = 3; 16 | let v2: Vec<_> = v.iter().map(|x| x * n).collect(); 17 | 18 | total = v2.iter().sum(); 19 | println!("v2 sum: {total}"); 20 | 21 | let v3: Vec<_> = v.into_iter().filter(|x| *x > 3).collect(); 22 | total = v3.iter().sum(); 23 | println!("v3 {:?} sum: {total}", v3); 24 | v3 25 | } 26 | 27 | fn show_values(iter: impl Iterator) { 28 | let values: Vec<_> = iter.collect(); 29 | println!("{}", values.join(", ")); 30 | } 31 | 32 | fn arguments() { 33 | show_values(env::args()) 34 | } 35 | 36 | pub fn run() { 37 | iterate(); 38 | arguments(); 39 | } 40 | 41 | #[cfg(test)] 42 | mod tests { 43 | use super::*; 44 | 45 | #[test] 46 | fn iterate_test() { 47 | let v3 = iterate(); 48 | assert_eq!(v3, vec![5, 4]) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /www/wavebox/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: white; 3 | font-family: 'Marvel', sans-serif; 4 | font-size: 18px; 5 | color: black; 6 | margin: auto 0px; 7 | } 8 | 9 | a { text-decoration: none; color: black; border-bottom: dotted #999999 1px } 10 | a:link {text-decoration: none; color: black; } 11 | a:visited {text-decoration: none; color: black; } 12 | a:active {text-decoration: none; color: black; } 13 | a:hover {text-decoration: none; color: black; border-bottom: dotted red 2px; } 14 | 15 | #wrapper { 16 | font-size: 18px; 17 | margin-left: auto; 18 | margin-right: auto; 19 | margin-top: 50px; 20 | display: block; 21 | padding: 20px; 22 | width: 90%; 23 | } 24 | 25 | h1 { font-family: "Aldrich", cursive; font-weight: bold; font-size: 36px;} 26 | 27 | a#play { 28 | font-family: "Aldrich", cursive; 29 | font-size: 26px; padding: 10px; 30 | background: #cccccc; 31 | border-bottom: none; 32 | color: black; 33 | } 34 | a#play:hover {text-decoration: none; color: black; 35 | border-bottom: solid red 2px; } 36 | 37 | p { padding: 10px; } 38 | 39 | #fftbox, #wavebox { 40 | position: absolute; 41 | width: 500; 42 | height: 100; 43 | } 44 | 45 | #canvasbox { 46 | position: relative; 47 | width: 500px; 48 | height: 100px; 49 | } 50 | -------------------------------------------------------------------------------- /haskell/homework2.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS -XTypeSynonymInstances #-} 2 | 3 | import Test.QuickCheck 4 | 5 | data Tree a = Leaf a | Node (Tree a) (Tree a) 6 | deriving (Show) 7 | 8 | reduce :: (a->a->a) -> Tree a -> a 9 | reduce f (Leaf l) = l 10 | reduce f (Node l r) = f (reduce f l) (reduce f r) 11 | 12 | toList :: Tree a -> [a] 13 | toList (Leaf l) = [l] 14 | toList (Node l r) = toList l ++ toList r 15 | 16 | reduceList :: (a->a->a) -> [a] -> a 17 | reduceList f (x : []) = x 18 | reduceList f (x : xs) = (f x (reduceList f xs)) 19 | 20 | prop_reduceTest :: (Int->Int->Int) -> TS -> Bool 21 | prop_reduceTest f tree = (reduce f tree) == (reduceList f (toList tree)) 22 | 23 | type TS = Tree Int 24 | instance Arbitrary TS where 25 | arbitrary = do 26 | n <- choose (1,2) :: Gen Int 27 | case n of 28 | 1 -> do i <- arbitrary 29 | return (Leaf i) 30 | 2 -> do t1 <- arbitrary 31 | t2 <- arbitrary 32 | return (Node t1 t2) 33 | 34 | main = do 35 | quickCheck (prop_reduceTest (+)) 36 | quickCheck (prop_reduceTest (*)) 37 | 38 | -- dumpTree x = do 39 | -- print $ x 40 | -- print $ toList x 41 | -- print $ (reduceList (+) (toList x)) 42 | -- print $ (reduce (+) (x)) 43 | -- main = do 44 | -- dumpTree $ Node (Node (Leaf 3) (Leaf 6)) (Leaf 5) 45 | -------------------------------------------------------------------------------- /python/webpinger.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2.6 2 | 3 | import string, cgi 4 | import os 5 | import re 6 | import sys 7 | import time 8 | import threading 9 | from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer 10 | from SocketServer import ForkingMixIn 11 | from threading import Thread 12 | 13 | class CometHandler(BaseHTTPRequestHandler): 14 | def do_GET(self): 15 | if self.path.endswith(".html"): 16 | self.send_response(200) 17 | self.send_header('Content-type', "text/plain") 18 | self.end_headers() 19 | 20 | self.wfile.write("Thread: " + threading.currentThread().getName() + "\n") 21 | pinger = os.popen("ping muthanna.com") 22 | 23 | while 1: 24 | line = pinger.readline() 25 | if not line: break 26 | self.wfile.write(line) 27 | 28 | else: 29 | self.send_error(404, "Not found.") 30 | 31 | def do_POST(self): 32 | self.do_GET 33 | 34 | class ThreadedHTTPServer(ForkingMixIn, HTTPServer): 35 | """Handles requests in a separate thread.""" 36 | pass 37 | 38 | def main(): 39 | try: 40 | server = ThreadedHTTPServer(('', 3000), CometHandler) 41 | print "Server listening on port 3000" 42 | server.serve_forever() 43 | except KeyboardInterrupt: 44 | server.socket.close() 45 | 46 | if __name__ == '__main__': 47 | main() 48 | --------------------------------------------------------------------------------