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
| """ | |
| Classic cart-pole system implemented by Rich Sutton et al. | |
| Copied from http://incompleteideas.net/sutton/book/code/pole.c | |
| permalink: https://perma.cc/C9ZM-652R | |
| Continuous version by Ian Danforth | |
| """ | |
| import math | |
| import gym |
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
| public class Base64 | |
| { | |
| public static String encode(byte[] data) | |
| { | |
| char[] tbl = { | |
| 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', | |
| 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f', | |
| 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', | |
| 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' }; |
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
| #Kasiski-Babbage cryptanalysis to get the text encripted with Vigenere | |
| import fractions | |
| import functools | |
| import re #Import regular expresions | |
| from collections import Counter | |
| #---------------------------------------------------------------------------------------------- | |
| #Search for the words with the given frecuency and length | |
| # @originalString [string]: the original text |
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
| MAX_KEY_LENGTH = 20 | |
| PEAK_MIN_OFFSET = 4 | |
| NUM_LETTERS = 26 | |
| FIRST_LETTER = "A" | |
| KEY_LENGTH_GUESS = 6 | |
| def index_of_coincidence(s, shift): | |
| """Find the index of coincidence of s with itself shifted by shift""" |
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
| public class Vigenere | |
| { | |
| //declare instance variables for text and keyword | |
| private String pt = ""; | |
| private String key = ""; | |
| Vigenere(){ //default constructor | |
| pt = ""; | |
| key = ""; | |
| } |
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
| public class Maze { | |
| public int counter = 0; | |
| public char[][] maze = | |
| {{'#', '#', '#', '#', '#', '#', '#', '#', '#', '#'}, | |
| {'#', ' ', ' ', ' ', '#', ' ', '#', ' ', ' ', '#'}, | |
| {'#', ' ', ' ', ' ', '#', ' ', '#', ' ', '#', '#'}, | |
| {'#', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'}, |
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
| # Install https://github.com/rg3/youtube-dl/ first. | |
| youtube-dl http://www.youtube.com/playlist\?list\=PLC0B137D835A3C970 -l --max-quality mp4 |
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
| #!/bin/bash | |
| ############# | |
| # FUNCTIONS | |
| ############# | |
| function h1 { | |
| echo | |
| echo "###################" | |
| echo "## $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
| from IPython.core.display import display | |
| class YouTubeVideo(object): | |
| """Class for embedding a YouTube Video in an IPython session, based on its video id. | |
| e.g. to embed the video on this page: | |
| http://www.youtube.com/watch?v=foo | |
| you would do: |
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
| #!/bin/sh | |
| SHORTCUT="[Desktop Entry] | |
| Name=Sublime Text 2 | |
| Comment=Edit text files | |
| Exec=/usr/local/sublime-text-2/sublime_text | |
| Icon=/usr/local/sublime-text-2/Icon/128x128/sublime_text.png | |
| Terminal=false | |
| Type=Application | |
| Encoding=UTF-8 | |
| Categories=Utility;TextEditor;" |
NewerOlder