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
/** | |
* Moving files to trashcan on Windows and Freedesktop. | |
* Copyright: | |
* Roman Chistokhodov, 2016 | |
* License: | |
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | |
*/ | |
import std.path; | |
import std.string; |
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
// Copyright (c) 2016 Roman Chistokhodov | |
// Distributed under the Boost Software License, Version 1.0. | |
// http://www.boost.org/LICENSE_1_0.txt | |
#include <stdio.h> | |
#include <stddef.h> | |
#if defined(__unix__) || defined(__APPLE__) | |
#include <unistd.h> | |
#endif |
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
// Copyright (c) 2016 Roman Chistokhodov | |
// Distributed under the Boost Software License, Version 1.0. | |
// http://www.boost.org/LICENSE_1_0.txt | |
#include <cstring> | |
#include <cstdlib> | |
#include <cassert> | |
#include <iostream> | |
#include <string> |
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
// Copyright (c) 2016 Roman Chistokhodov | |
// Distributed under the Boost Software License, Version 1.0. | |
// http://www.boost.org/LICENSE_1_0.txt | |
#if (defined(__linux__) && !defined __ANDROID__) || defined (__FreeBSD__) || defined (__NetBSD__) || defined(__OpenBSD__) | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <sys/resource.h> | |
#include <unistd.h> | |
#include <fcntl.h> |
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
// Copyright (c) 2016 Roman Chistokhodov | |
// Distributed under the Boost Software License, Version 1.0. | |
// http://www.boost.org/LICENSE_1_0.txt | |
/* | |
* Q: Why? | |
* A: The idea is to use STL iterators to iterate over zero terminated string without calling of strlen to evaluate the end iterator. | |
* | |
* Q: Why not random access? | |
* A: Currently the 'end' iterator is implemented as NULL and it's not obvious how it should work with '-' (minus) operator, |
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 <iterator> | |
#include <string> | |
#include <cassert> | |
template<typename T> | |
struct Only | |
{ | |
struct iterator : public std::iterator<std::forward_iterator_tag, T> | |
{ | |
iterator(Only* only, bool isEnd = false) : _only(only), _isEnd(isEnd) { |
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 | |
from= | |
to= | |
if [ -z "$1" ] | |
then | |
echo "Error: no arguments" | |
exit 0 | |
else |
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/sh | |
exec tail -n +3 $0 | |
# This file provides an easy way to add custom menu entries. Simply type the | |
# menu entries you want to add after this comment. Be careful not to change | |
# the 'exec tail' line above. | |
menuentry 'FreeBSD' { | |
insmod ufs2 | |
insmod bsd | |
search --fs-uuid --no-floppy --set=root *use blkid to get device UUID and insert here* |
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
#user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; |
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/sh | |
gen_texture() | |
{ | |
name=$1 | |
color1=$2 | |
color2=$3 | |
textcolor=$4 | |
text=$(echo -n "$name" | tr '[:lower:]' '[:upper:]') | |
convert -size 64x64 xc:"$color2" -fill "$color1" -draw "rectangle 0,0 32,32" -draw "rectangle 32,32 64,64" \ |
OlderNewer