This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| su root | |
| # Don't you hate when you need to root to fix dumb issues? | |
| service network-manager stop | |
| rm /var/lib/NetworkManager/NetworkManager.state | |
| service network-manager start | |
| reboot -h now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val l = Seq(Seq(1,2), Seq(3,4), Seq(5,6)) | |
| val l2 = l.map(_.map(Seq(_))) | |
| l2.reduceLeft((xs, ys) => for {x <- xs; y <- ys} yield x ++ y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "allow creation of new entries" >> setupData { | |
| val datum = data.insert(new Datum(0, Some(1),Some(""), Some("ftp.example.org"), Some("username"), Some("password"), Some(new java.util.Date))) | |
| datum.id must_== 1 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a = 'abcd' | |
| comb=: 4 : 0 | |
| k=. i.>:d=.y-x | |
| z=. (d$<i.0 0),<i.1 0 | |
| for. i.x do. z=. k ,.&.> ,&.>/\. >:&.> z end. | |
| ; z | |
| ) | |
| (2 comb #a) { a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Notes - | |
| Try to get softer butter as it's easier to work with. | |
| Don't overmix. If you do it might cause the cake to not rise properly. | |
| If your cake it golden, then it's done. | |
| Get a torch to if your oven doesn't have a light in it as you don't want to repeatedly open your oven to see how your cake is doing as it let the heat escape. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Permutation Game (30 Points) | |
| Alice and Bob play the following game: | |
| 1) They choose a permutation of the first N numbers to begin with. | |
| 2) They play alternately and Alice plays first. | |
| 3) In a turn, they can remove any one remaining number from the permutation. | |
| 4) The game ends when the remaining numbers form an increasing sequence. The person who played the last turn (after which the sequence becomes increasing) wins the game. | |
| Assuming both play optimally, who wins the game? | |
| Input: | |
| The first line contains the number of test cases T. T test cases follow. Each case contains an integer N on the first line, followed by a permutation of the integers 1..N on the second line. | |
| Output: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [data-component-term="trends"] *, | |
| [data-component-term="user_recommendations"] *, | |
| [data-component-term="discover_nav"] *, | |
| [data-screen-name="username"] * { | |
| display: none !important; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Light loader | |
| */ | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| html { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; Iterative count | |
| (defn count [sent] | |
| (defn iter [wds result] | |
| (if (empty? wds) | |
| result | |
| (iter (rest wds) (+ 1 result)))) | |
| (iter sent 0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //This wee bit o' CoffeeScript | |
| editor = CodeMirror.fromTextArea(document.getElementById('id_body'), | |
| mode: "markdown" | |
| lineNumbers: false | |
| lineWrapping: true | |
| onCursorActivity: () -> | |
| setLineClass(hlLine, null) | |
| hlLine = editor.setLineClass(editor.getCursor().line, "activeline")) |