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
#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
#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
#!/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
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 has been truncated, but you can view the full file.
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 in a year $y mod 400 = 0$ | |
Jan 2 in a year $y mod 400 = 0$ | |
Jan 3 in a year $y mod 400 = 0$ | |
Jan 4 in a year $y mod 400 = 0$ | |
Jan 5 in a year $y mod 400 = 0$ | |
Jan 6 in a year $y mod 400 = 0$ | |
Jan 7 in a year $y mod 400 = 0$ | |
Jan 8 in a year $y mod 400 = 0$ | |
Jan 9 in a year $y mod 400 = 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
/* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
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 python3 | |
import argparse | |
import functools | |
import hmac | |
import json | |
import plistlib | |
import subprocess |
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
pub fn voidfn() -> () {} |
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 -c ' | |
if [ "$(whoami)" = root ]; then | |
echo "No, you are supposed to run this bit as non-root" | |
exit 1 | |
fi | |
sudo -v | |
pass=$(openssl rand -hex 16 | sed -e "s/\\(....\\)/\\1-/g; s/-\$//") | |
echo "Chosen random password: $pass" | |
{ | |
echo "root:$pass" |