This file contains 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 | |
# | |
# Author: Gary Macindoe | |
# Date: May 2013 | |
files="/etc/portage/package.accept_keywords /etc/portage/package.keywords" | |
fs="" | |
for f in ${files} | |
do | |
if [ -d "${f}" ] |
This file contains 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 | |
# | |
# Author: Gary Macindoe | |
# Date: May 2013 | |
files="/etc/portage/package.use" | |
if [ -d "${files}" ] | |
then | |
files="${files}/*" | |
fi |
This file contains 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 | |
# | |
# Author: Gary Macindoe | |
# Date: November 2014 | |
set -eu | |
EFI_KEYS="/root/efi" | |
LINUX_SOURCE="/usr/src/linux" |
This file contains 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 | |
# | |
# Author: Gary Macindoe | |
# Date: May 2015 | |
WORLD_FILE=/var/lib/portage/world | |
while read package; | |
do | |
DEPS=$(grep -l ${package} /var/db/pkg/*/*/{,R}DEPEND | cut -d'/' -f5,6 | sort -u); |
This file contains 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 <type_traits> | |
#include <limits> | |
template <typename UIntType, UIntType v, unsigned int n> | |
struct set_lower_bits : public std::integral_constant<UIntType, v | (v >> n) | set_lower_bits<UIntType, v | (v >> n), (n >> 1)>::value> {}; | |
template <typename UIntType, UIntType v> | |
struct set_lower_bits<UIntType, v, 1> : public std::integral_constant<UIntType, v | (v >> 1)> {}; | |
template <typename UIntType, UIntType v> |
This file contains 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> | |
class A { | |
virtual void function() const { | |
std::cout << "You bastard!" << std::endl; | |
} | |
}; | |
int main() { | |
A a; |
This file contains 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
/* | |
* Implementation of voxel traversal algorithm from "A Fast Voxel Traversal | |
* Algorithm for Ray Tracing" (Amanatides and Woo). | |
*/ | |
#include <iostream> | |
#include <iterator> | |
#include <tuple> | |
#include <limits> | |
#include <algorithm> |
This file contains 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 | |
# | |
# Converts mercurial repostories to git repositories. | |
# Requires git-remote-hg from https://github.com/felipec/git-remote-hg. | |
# | |
if [ $# -lt 2 ] || [ $# -gt 3 ] | |
then | |
echo "Usage: ${0} <url> <local_directory> [user_map]" | |
echo "Where" |
This file contains 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 <inttypes.h> | |
#include <math.h> | |
uint64_t fibonacci(uint64_t n) { | |
static const double golden = 1.61803398874989484820; | |
return (uint64_t)floor((pow(golden, (double)n) / sqrt(5.0)) + 0.5); | |
} | |
This file contains 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 <tuple> | |
#include <iterator> | |
#include <algorithm> | |
template <class InputIterator> | |
std::tuple<typename std::iterator_traits<InputIterator>::value_type, | |
InputIterator, InputIterator> | |
maximum_subarray(InputIterator first, InputIterator last) { | |
typedef typename std::iterator_traits<InputIterator>::value_type value_type; | |
using std::max; |
OlderNewer