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
$ rm -rf /tmp/foo | |
$ rm -rf /tmp/quo | |
$ mkdir -p -m 777 /tmp/quo/quox/quark | |
$ php -r 'mkdir("/tmp/foo/bar/baz/bang", 0777, true);' | |
$ stat -c "%a %n" /tmp/quo/quox/quark | |
777 /tmp/quo/quox/quark | |
$ stat -c "%a %n" /tmp/foo/bar/baz/bang | |
755 /tmp/foo/bar/baz/bang | |
$ stat -c "%a %n" /tmp/quo | |
755 /tmp/quo |
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
<?php | |
date_default_timezone_set('Europe/Berlin'); | |
$dayList = array( | |
new DateTime('2012-03-01'), | |
new DateTime('2012-03-02'), | |
new DateTime('2012-03-03'), | |
new DateTime('2012-03-04'), | |
new DateTime('2012-03-05'), |
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
<?php | |
use PHP_CodeSniffer_File as CodeSnifferFile; | |
use PHP_CodeSniffer_Sniff as CodeSnifferSniff; | |
/** | |
* Code originally from https://github.com/InterNations/kodierungsregelwerksammlung/blob/master/src/InterNations/Sniffs/Waste/SuperfluousUseStatementsSniff.php | |
* | |
* Slightly modified to be compatible with phpcs2, because original sniff from InterNations was not compatible with phpcs2 | |
* because of changes in how phpcs parses doc comment blocks: https://www.squizlabs.com/php-codesniffer/2.0.0a1-released | |
*/ |
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
;; moved to https://github.com/maxbeutel/my-emacs-config |
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 | |
host=$1 | |
port=${PORT:-11211} | |
grepfor=$2 | |
echo -e "stats items\nquit" | nc $host $port | cut -d: -f2 | sort -n | uniq | grep -v END | while read i; do echo -e "stats cachedump $i 100000\nquit" | nc $host $port | grep $grepfor; done |
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
g++ main.cpp -I./external/include -I./hazelcast/include -I./hazelcast/generated-sources/include ./build/libHazelcastClient3.7-SNAPSHOT_64.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
### mostly stolen from http://eigenstate.org/notes/makefiles | |
CC = clang | |
SHELL = /bin/bash | |
CFLAGS += -std=c11 -pedantic -Werror -Wall -Wextra -Isrc | |
DEV_CFLAGS = -O0 -ggdb | |
SOURCES=$(wildcard src/**/*.c src/*.c) | |
LIBOBJ=$(patsubst %.c,%.o,$(SOURCES)) |
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
// backporting of "Vec::dedup_by" and "Vec::dedup_by_key" | |
// https://github.com/rust-lang/rust/pull/36743 | |
use std::mem; | |
trait DedupedVec<T> { | |
fn dedup_by_key<F, K>(&mut self, mut key: F) where F: FnMut(&mut T) -> K, K: PartialEq; | |
fn dedup_by<F>(&mut self, mut same_bucket: F) where F: FnMut(&mut T, &mut T) -> bool; | |
} |
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
(defun my-at-expression-paredit-space-for-delimiter-predicate (endp delimiter) | |
(if (and (member major-mode '(php-mode rust-mode c-mode)) | |
(not endp)) | |
(not (or (and (memq delimiter '(?\[ ?\{ ?\())))) | |
t)) | |
(add-hook 'paredit-space-for-delimiter-predicates | |
#'my-at-expression-paredit-space-for-delimiter-predicate) |
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
// based on http://stackoverflow.com/a/34722500 | |
fn draw_line<T: GenericImage>(img: &mut T, x0: i64, y0: i64, x1: i64, y1: i64, pixel: T::Pixel) { | |
// Create local variables for moving start point | |
let mut x0 = x0; | |
let mut y0 = y0; | |
// Get absolute x/y offset | |
let dx = if x0 > x1 { x0 - x1 } else { x1 - x0 }; | |
let dy = if y0 > y1 { y0 - y1 } else { y1 - y0 }; |
OlderNewer