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
| # prerequisites: curl, jq (brew install jq), openssl | |
| echo "To:" | |
| read EMAIL | |
| # retrieve user info (login+ssh key) from github | |
| LOGIN=`curl -s https://api.github.com/search/users?q=$LOGIN | jq -r '.items[0].login'` | |
| KEY=`curl -s https://api.github.com/users/$LOGIN/keys | jq -r '.[0].key'` | |
| echo $KEY > $LOGIN.pub |
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
| #!/usr/sbin/dtrace -s | |
| syscall::read:entry | |
| /execname == "sh" || execname == "ksh" || execname == "csh" || | |
| execname == "tcsh" || execname == "zsh" || execname == "bash"/ | |
| { | |
| self->start = timestamp; | |
| self->buf = arg1; | |
| self->len = arg2; | |
| } |
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
| interface Animal { | |
| void eat() | |
| } | |
| class Mammal implements Animal { | |
| void eat() { | |
| System.out.println("mammal eating"); | |
| } | |
| } |
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 Coordinates { | |
| private double longitude; | |
| private double latitude; | |
| public Coordinates(double longitude, double latitude) { | |
| this.longitude = longitude; | |
| this.latitude = latitude; | |
| } | |
| } |
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 Stack { | |
| private Object [ ] items ; | |
| private int top ; | |
| public Stack ( int size ) { | |
| this items = new Object [ size ] ; | |
| this top = - 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
| CLIENTES | |
| ======== | |
| id: INT | |
| nombre: VARCHAR(255) | |
| dni: VARCHAR(12) | |
| PEDIDOS | |
| ======= | |
| id: INT | |
| id_producto: INT |
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
| Map<String, String> map = new HashMap<String, String>(); | |
| map.put("1","abc"); | |
| map.put("2", "def"); | |
| for (Map.Entry<String, String> entry : map.entrySet()) { | |
| System.out.println(entry.getValue() + ":" + entry.getKey()); | |
| } |
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 String apply(String input) { | |
| char[] chars = input.toCharArray(); | |
| int index; | |
| for (index = 0; index < input.length(); index++) { | |
| if (chars[index] != '0') { | |
| break; | |
| } | |
| } | |
| return (index == 0) ? input : input.substring(index); |
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
| for n in range(2, 1000): | |
| for x in range(2, n): | |
| if n % x == 0: | |
| print n, 'equals', x, '*', n/x | |
| break | |
| else: | |
| print n, ' true' |
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
| import unittest | |
| def IsOdd(n): | |
| return n % 2 == 1 | |
| class IsOddTests(unittest.TestCase): | |
| def testOne(self): | |
| self.failUnless(IsOdd(1)) | |
| def testTwo(self): |