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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define xD int | |
| #define CB p[x] | |
| #define l8(o) for(int o =0; o <n; o ++){ | |
| #define D(C) if(C+1!=n) | |
| #define O8 printf( | |
| //The flame of spiraling numbers | |
| //run this program and enter a positive integer to get a number spiral with the specified width |
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
| glBegin(GL_QUADS); | |
| glColor3f(1.0f, 0.0f, 0.0f); | |
| glVertex3f(1,1,1); | |
| glVertex3f(-1,1,1); | |
| glVertex3f(-1,-1,1); | |
| glVertex3f(1,-1,1); | |
| glColor3f(1.0f, 1.0f, 0.0f); | |
| glVertex3f(1,1,1); | |
| glVertex3f(-1,1,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
| #!/usr/bin/env sh | |
| echo '#!/usr/bin/env perl | |
| $n=$ARGV[0];my$i; | |
| open($i,'"'"'<'"'"',$n)or die$!;@p=<$i>; | |
| open($i,'"'"'>'"'"',$n)or die$!; | |
| for(@p){$a&&$_=~s/pick/s/;$a=1; | |
| printf$i $_}' > s.pl | |
| echo '#!/usr/bin/env perl | |
| $n=$ARGV[0];my$i; | |
| open($i,'"'"'>'"'"',$n)or die$!; |
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
| while true; do | |
| echo -e "\n\nCurrent system time:" | |
| date | |
| read -p "Is this correct? [y/n] " yn | |
| case $yn in | |
| [Yy]* ) break;; | |
| [Nn]* ) | |
| read -p "Please enter the current date as DD/MM/YYYY: " userdateinput | |
| echo $userdateinput | perl -pe 's:(\d{2}/)(\d{2}/)(\d{4}):$2$1$3:' | xargs date +"%d/%m/%Y" -s | |
| read -p "Please enter the current time as 24 hour time (HH:MM): " usertimeinput |
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/bin/env bash | |
| # scan the staged files for added prints | |
| git diff --cached | grep -e"+.*print.*" > .diff_contains_prints | |
| # find the number of print lines | |
| NUMPRINTS=`wc -l .diff_contains_prints | sed "s/\(.\).*/\1/"` | |
| # check if there are one or more new print lines | |
| if [[ $NUMPRINTS -ge 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
| #!/usr/bin/bash | |
| # Script to confirm git commits with -a if files are already staged. | |
| # Alias git to this script in your shell. | |
| # If no options are given, call git with no options (and optionally accuse the user of being a fool) | |
| if [[ $# < 1 ]] | |
| then | |
| git | |
| exit |
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
| /* | |
| Before this problem was patched, you could go to http://www.glasses2you.co.uk/ and click | |
| on "YOUR ACCOUNT", type in the email address of the target account and click next, then | |
| just paste this file into the javascript console (after making the obvious change that | |
| makes it work for any account). | |
| After that, you'd wait for about thirty seconds and the password would be printed on the | |
| console, then you could click some other link on the site and you'd be logged in on the | |
| next page. |
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
| """ | |
| Make tests go faster. | |
| usage: | |
| import timetravel | |
| timetravel.enable_time_travel() | |
| """ | |
| import sys | |
| import datetime | |
| import time |
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
| class Vector(): | |
| """ Horrible bad vector implementation """ | |
| def __init__(self, *args): | |
| self._vector = list(args) | |
| def __str__(self): | |
| return str("<%s>" % (", ".join([str(v) for v in self._vector]))) | |
| def __getitem__(self, index): | |
| return self._vector[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
| class Node: | |
| def __init__(self, val, nxt): | |
| self.val = val | |
| self.nxt = nxt | |
| def change(self, val, nxt): | |
| self.val = val | |
| self.nxt = nxt |
OlderNewer