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
Jan 1 of a year with $y mod 400 = 0$, | |
Jan 2 of a year with $y mod 400 = 0$, | |
... | |
Feb 28 of a year with $y mod 400 = 0$, | |
Feb 29 of a year with $y mod 400 = 0$, | |
Mar 1 of a year with $y mod 400 = 0$, | |
... | |
Dec 31 of a year with $y mod 400 = 0$, | |
Jan 1 of a year with $y mod 400 = 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 python | |
months = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ") | |
days_normal = map(int, "31 28 31 30 31 30 31 31 30 31 30 31".split(" ")) | |
days_leap = map(int, "31 29 31 30 31 30 31 31 30 31 30 31".split(" ")) | |
assert len(months) == 12 | |
assert len(days_normal) == 12 | |
assert len(days_normal) == 12 | |
assert sum(days_normal) == 365 |
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 <errno.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/file.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
/* Compile with any c99 compiler: |
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 <iostream> | |
#include <string> | |
using std::string; | |
void passByVal(string passBy) { | |
passBy = "reference"; | |
} | |
void passByRef(string &passBy) { |
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/perl | |
use strict; | |
use warnings; | |
use autodie; | |
use Time::Piece; | |
use Time::Seconds; | |
use Getopt::Long; |
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/perl | |
use strict; | |
use warnings; | |
use 5.010; | |
use autodie; | |
use File::Temp qw(tempdir); | |
use File::Spec; | |
use File::Slurp qw(read_dir); |
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
diff -ru OpenSSH-186 2/openssh/ssh.c OpenSSH-186/openssh/ssh.c | |
--- OpenSSH-186 2/openssh/ssh.c 2013-07-02 16:09:16.000000000 -0700 | |
+++ OpenSSH-186/openssh/ssh.c 2014-08-30 03:32:29.000000000 -0700 | |
@@ -1505,6 +1505,7 @@ | |
u_int n_ids; | |
char *identity_files[SSH_MAX_IDENTITY_FILES]; | |
Key *identity_keys[SSH_MAX_IDENTITY_FILES]; | |
+ int identity_file_userprovided[SSH_MAX_IDENTITY_FILES]; | |
#ifdef ENABLE_PKCS11 | |
Key **keys; |
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 perl | |
use strict; | |
use warnings; | |
use XML::XPath; | |
@ARGV == 1 or die "Usage: $0 infile.xml\n"; | |
my ($infile) = @ARGV; | |
my $xp; |
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
<!DOCTYPE html | |
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<title>Blah</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<body> | |
<script type="text/javascript"> | |
x = "blah"; | |
for (i=0; i<28; i++) { |
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
#!bash | |
# database scan for enhanced cd command | |
cds() { | |
( | |
set -o pipefail | |
# XXX: handle directories with newlines in their names? | |
find "$HOME" -type d -print \ | |
| sort -u > "$HOME/.cdpaths" | |
exit $? |