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
cat <<'EOFFILE' >/usr/local/bin/rrd-backup | |
#!/bin/sh | |
set -e | |
mkdir -p /usr/local/share/rrd | |
cd /tmp | |
chsum_prev=`tar -cf - rrd | md5sum` | |
while true; do | |
chsum=`tar -cf - rrd | tee rrd.tar | md5sum` |
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
# prevent leaked/orphaned ssh-agent processes | |
if [ -z "$SSH_AUTH_SOCK" ]; then | |
eval "`ssh-agent`" >/dev/null | |
ssh-add 2>/dev/null | |
# create pipe handle to share across all processes | |
coproc ( | |
read s # to avoid race condition do not die until we disown/do stuff with $COPROC | |
# detach from tty | |
setsid sh -c " |
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
COMPILE = gcc | |
DEPDIR = .deps | |
am__mv = mv | |
OBJECTS = foo.o bar.o | |
all: $(OBJECTS) | |
# The recipe for stdafx.uptodate ensures that the .gch file is up to date | |
$(OBJECTS): stdafx.uptodate |
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
================================================================== | |
Building ksh from RedHat on other Linux (with -fsanitize=address) | |
================================================================== | |
# First login to a RHEL 6.8 host | |
# download ksh source package | |
cd ~/rpmbuild/SRPMS/ | |
yumdownloader --source ksh |
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
/* | |
Fill buffer with random data using rand() | |
void fillrand(unsigned char *buf, size_t sz); | |
void wfillrand(unsigned short *buf, size_t nelems); | |
Fastest functions according to test results: | |
i686: |
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 <sys/types.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <glib.h> | |
/* opaque glib structures */ | |
typedef struct _GTreeNode GTreeNode; |
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
/* | |
* How to delay log4j messages targeted for a FileAppender until certain condition is met? | |
* | |
* My java program is a command line tool that is supposed to run single-instanced. For that a | |
* pidfile support was added to it. However, there's some 3rd-party initialization code that runs | |
* before the pidfile check and writes to log4j. | |
* | |
* I'm not happy that my logfile contains messages from a process that exited due to the locked | |
* pidfile, however, I want the ConsoleAppender to keep working as today. | |
* |
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
package org.foo.unfairqueue; | |
import java.util.Collection; | |
import java.util.Iterator; | |
import java.util.concurrent.BlockingQueue; | |
import java.util.concurrent.TimeUnit; | |
/** see ForwardingBlockingQueue from guava */ | |
public class ForwardingBlockingQueue<E> implements BlockingQueue<E> { | |
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
package org.foo.concurrentauthenticator; | |
import java.net.Authenticator; | |
import java.net.PasswordAuthentication; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.ThreadFactory; |
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
package org.foo.pidfilelock; | |
import java.io.Closeable; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.RandomAccessFile; | |
import java.io.Reader; | |
import java.lang.management.ManagementFactory; | |
import java.nio.CharBuffer; | |
import java.nio.channels.Channels; |
OlderNewer