Simple hex excercises

hexmeh.sublime-workspace 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. {
  2. "auto_complete":
  3. {
  4. "selected_items":
  5. [
  6. [
  7. "file",
  8. "file"
  9. ],
  10. [
  11. "read",
  12. "readBlob"
  13. ],
  14. [
  15. "otp",
  16. "outputLine"
  17. ],
  18. [
  19. "binary",
  20. "binaryLength"
  21. ],
  22. [
  23. "generate",
  24. "generateBinary"
  25. ]
  26. ]
  27. },
  28. "buffers":
  29. [
  30. {
  31. "file": "partials/dump.html",
  32. "settings":
  33. {
  34. "buffer_size": 592,
  35. "line_ending": "Unix"
  36. }
  37. },
  38. {
  39. "file": "index.html",
  40. "settings":
  41. {
  42. "buffer_size": 1526,
  43. "line_ending": "Unix"
  44. }
  45. },
  46. {
  47. "contents": "'use strict';\n\nfunction MainController($scope, $routeParams) {\n $scope.allowedLengths = [4, 8, 16, 32, 64, 128, 256];\n $scope.binaryLength = 64;\n $scope.binary = generateBinary($scope.binaryLength);\n $scope.parts = [];\n $scope.hex = \"\";\n \n $scope.displayResults = function () {\n return $scope.hex.length > 0;\n };\n \n $scope.generate = function () {\n $scope.binary = generateBinary($scope.binaryLength);\n $scope.parts = [];\n $scope.hex = \"\";\n \n return false;\n };\n \n $scope.solve = function () {\n $scope.parts = [];\n $scope.hex = \"\";\n \n var original = $scope.binary;\n \n while (original.length > 0) {\n // Find the 16 bytes we need.\n var part = original.substr(-4);\n var character = binaryToHex(part);\n \n // Divvy this stuff up.\n $scope.parts.push({ \"binary\": part, \"hex\": character });\n $scope.hex = character + $scope.hex;\n \n // Remove the last four.\n original = original.substr(0, original.length - 4);\n }\n \n return false;\n };\n}\n\nfunction DumpController($scope, $routeParams) {\n $scope.columns = 16;\n $scope.fileApi = false;\n $scope.instructions = \"Drop a file here!\";\n $scope.uppercaseHex = false;\n $scope.file = null;\n $scope.lastLine = 0;\n \n $scope.isProcessing = function () {\n\n };\n\n function outputLine(bytes) {\n // Add a break line.\n $(\"#lineNumbers, #lineHex, #lineCharacters\").append(\"<br>\");\n \n // Get the line number.\n var lineNumber = padLeft($scope.lastLine.toString(16), 6);\n if ($scope.uppercaseHex) {\n lineNumber = lineNumber.toUpperCase();\n }\n $(\"#lineNumbers\").append(lineNumber + \"<span class='symbol'>:</span>\");\n \n for (var i = 0; i < bytes.length; i++) {\n // Get the hex string.\n var hexString = padLeft(bytes[i].toString(16), 2);\n if ($scope.uppercaseHex) {\n hexString = hexString.toUpperCase();\n }\n \n // Output the remaining lines.\n $(\"#lineHex\").append(hexString + \"&nbsp;\");\n $(\"#lineCharacters\").append(String.fromCharCode(bytes[i]));\n }\n\n // Increment to next line.\n $scope.lastLine++;\n }\n\n function readBlob(start, stop) {\n if (start < $scope.file.size) {\n var reader = new FileReader();\n \n // Closure to capture the file information.\n reader.onload = function(evt) {\n var bytes = new Uint8Array(evt.target.result);\n outputLine(bytes);\n readBlob(stop, stop + $scope.columns);\n }\n\n var blob = $scope.file.webkitSlice(start, stop);\n reader.readAsArrayBuffer(blob);\n }\n }\n \n // Check for the various File API support.\n if (window.File && window.FileReader && window.FileList && window.Blob) {\n // Great success! All the File APIs are supported.\n $(\"#drop-zone\").bind(\"dragover\", function (e) {\n e.stopPropagation();\n e.preventDefault();\n e.originalEvent.dataTransfer.dropEffect = 'copy';\n });\n \n $(\"#drop-zone\").bind(\"drop\", function(e) {\n e.stopPropagation();\n e.preventDefault();\n \n // Remove previous output.\n $(\"#lineNumbers, #lineHex, #lineCharacters\").empty();\n $scope.lastLine = 0;\n $scope.file = null;\n\n //$(\"#drop-zone\").append($(\"<div id='progress_bar'><div class='percent'>0%</div></div>\"));\n //var progress = $(\".percent\");\n \n // Retrieve the files.\n var files = e.originalEvent.dataTransfer.files;\n if (files) {\n $scope.file = files[0];\n readBlob(0, $scope.columns);\n }\n });\n } \n else {\n $scope.fileApi = false;\n $scope.instructions = \"Sorry, your browser needs to go to an old folks home.\";\n alert('The File APIs are not fully supported in this browser.');\n }\n}",
  48. "file": "scripts/controllers.js",
  49. "file_size": 3704,
  50. "file_write_time": 1348693725000000,
  51. "settings":
  52. {
  53. "buffer_size": 3707,
  54. "line_ending": "Unix"
  55. }
  56. },
  57. {
  58. "file": "styles/hexmeh.css",
  59. "settings":
  60. {
  61. "buffer_size": 10926,
  62. "line_ending": "Unix"
  63. }
  64. }
  65. ],
  66. "build_system": "",
  67. "command_palette":
  68. {
  69. "height": 0.0,
  70. "selected_items":
  71. [
  72. ],
  73. "width": 0.0
  74. },
  75. "console":
  76. {
  77. "height": 0.0
  78. },
  79. "distraction_free":
  80. {
  81. "menu_visible": true,
  82. "show_minimap": false,
  83. "show_open_files": false,
  84. "show_tabs": false,
  85. "side_bar_visible": false,
  86. "status_bar_visible": false
  87. },
  88. "file_history":
  89. [
  90. "/home/bryan/Projects/hexmeh/scripts/app.js",
  91. "/home/bryan/Projects/hexmeh/scripts/components.js",
  92. "/home/bryan/Projects/hexmeh/scripts/utilities.js",
  93. "/home/bryan/Projects/hexmeh/styles/hexmeh.css",
  94. "/home/bryan/Projects/hexmeh/index.html",
  95. "/home/bryan/Projects/hexmeh/scripts/controllers.js",
  96. "/home/bryan/Projects/hexmeh/partials/intro.html",
  97. "/home/bryan/Projects/hexmeh/scripts/services.js",
  98. "/home/bryan/Projects/hexmeh/crossdomain.xml",
  99. "/home/bryan/Projects/hexmeh/.gitignore",
  100. "/home/bryan/Projects/hexmeh/README.md",
  101. "/home/bryan/Projects/whistle/scripts/app.js",
  102. "/home/bryan/Projects/whistle/scripts/utilities.js",
  103. "/home/bryan/Projects/whistle/index.html",
  104. "/home/bryan/Projects/azucar-fitness/www/Templates/main-template.dwt"
  105. ],
  106. "find":
  107. {
  108. "height": 35.0
  109. },
  110. "find_in_files":
  111. {
  112. "height": 0.0,
  113. "where_history":
  114. [
  115. ]
  116. },
  117. "find_state":
  118. {
  119. "case_sensitive": false,
  120. "find_history":
  121. [
  122. "whistler"
  123. ],
  124. "highlight": true,
  125. "in_selection": false,
  126. "preserve_case": false,
  127. "regex": false,
  128. "replace_history":
  129. [
  130. ],
  131. "reverse": false,
  132. "show_context": true,
  133. "use_buffer2": true,
  134. "whole_word": false,
  135. "wrap": true
  136. },
  137. "groups":
  138. [
  139. {
  140. "selected": 2,
  141. "sheets":
  142. [
  143. {
  144. "buffer": 0,
  145. "file": "partials/dump.html",
  146. "settings":
  147. {
  148. "buffer_size": 592,
  149. "regions":
  150. {
  151. },
  152. "selection":
  153. [
  154. [
  155. 488,
  156. 488
  157. ]
  158. ],
  159. "settings":
  160. {
  161. "syntax": "Packages/HTML/HTML.tmLanguage",
  162. "tab_size": 4,
  163. "translate_tabs_to_spaces": true
  164. },
  165. "translation.x": 0.0,
  166. "translation.y": 0.0,
  167. "zoom_level": 1.0
  168. },
  169. "type": "text"
  170. },
  171. {
  172. "buffer": 1,
  173. "file": "index.html",
  174. "settings":
  175. {
  176. "buffer_size": 1526,
  177. "regions":
  178. {
  179. },
  180. "selection":
  181. [
  182. [
  183. 0,
  184. 0
  185. ]
  186. ],
  187. "settings":
  188. {
  189. "syntax": "Packages/HTML/HTML.tmLanguage",
  190. "tab_size": 4,
  191. "translate_tabs_to_spaces": true
  192. },
  193. "translation.x": 0.0,
  194. "translation.y": 0.0,
  195. "zoom_level": 1.0
  196. },
  197. "type": "text"
  198. },
  199. {
  200. "buffer": 2,
  201. "file": "scripts/controllers.js",
  202. "settings":
  203. {
  204. "buffer_size": 3707,
  205. "regions":
  206. {
  207. },
  208. "selection":
  209. [
  210. [
  211. 1296,
  212. 1296
  213. ]
  214. ],
  215. "settings":
  216. {
  217. "syntax": "Packages/JavaScript/JavaScript.tmLanguage",
  218. "tab_size": 2,
  219. "translate_tabs_to_spaces": true
  220. },
  221. "translation.x": 0.0,
  222. "translation.y": 833.0,
  223. "zoom_level": 1.0
  224. },
  225. "type": "text"
  226. },
  227. {
  228. "buffer": 3,
  229. "file": "styles/hexmeh.css",
  230. "settings":
  231. {
  232. "buffer_size": 10926,
  233. "regions":
  234. {
  235. },
  236. "selection":
  237. [
  238. [
  239. 74,
  240. 74
  241. ]
  242. ],
  243. "settings":
  244. {
  245. "syntax": "Packages/CSS/CSS.tmLanguage"
  246. },
  247. "translation.x": 0.0,
  248. "translation.y": 1734.0,
  249. "zoom_level": 1.0
  250. },
  251. "type": "text"
  252. }
  253. ]
  254. }
  255. ],
  256. "incremental_find":
  257. {
  258. "height": 0.0
  259. },
  260. "input":
  261. {
  262. "height": 33.0
  263. },
  264. "layout":
  265. {
  266. "cells":
  267. [
  268. [
  269. 0,
  270. 0,
  271. 1,
  272. 1
  273. ]
  274. ],
  275. "cols":
  276. [
  277. 0.0,
  278. 1.0
  279. ],
  280. "rows":
  281. [
  282. 0.0,
  283. 1.0
  284. ]
  285. },
  286. "menu_visible": true,
  287. "replace":
  288. {
  289. "height": 0.0
  290. },
  291. "save_all_on_build": true,
  292. "select_file":
  293. {
  294. "height": 0.0,
  295. "selected_items":
  296. [
  297. ],
  298. "width": 0.0
  299. },
  300. "select_project":
  301. {
  302. "height": 500.0,
  303. "selected_items":
  304. [
  305. [
  306. "",
  307. "/home/bryan/Projects/whistle/whistle.sublime-project"
  308. ]
  309. ],
  310. "width": 380.0
  311. },
  312. "show_minimap": true,
  313. "show_open_files": false,
  314. "show_tabs": true,
  315. "side_bar_visible": true,
  316. "side_bar_width": 243.0,
  317. "status_bar_visible": true
  318. }