Skip to content

Instantly share code, notes, and snippets.

View Ikke's full-sized avatar

Kevin Daudt Ikke

  • Netherlands
  • 13:52 (UTC +02:00)
View GitHub Profile
@Ikke
Ikke / sync_files.sh
Last active October 18, 2018 14:47
Devops scripts
#!/bin/bash
source $PWD/.sync_settings
if [[ -z "$SYNC_HOST" ]]; then
echo "Please specify SYNC_HOST in .sync_settings"
exit 1
fi
if [[ -z "$SYNC_HOST" ]]; then
diff --git a/srclib/stdio.in.h b/srclib/stdio.in.h.new
index 473c84c..499b073 100644
--- a/srclib/stdio.in.h
+++ b/srclib/stdio.in.h
@@ -695,7 +695,9 @@ _GL_CXXALIASWARN (gets);
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
+ #if HAVE_RAW_DECL_GETS
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
--- src/Makefile.am 2016-01-24 16:48:49.067408827 +0100
+++ src/Makefile.am.new 2016-01-24 16:48:59.294290424 +0100
@@ -1,7 +1,7 @@
bin_PROGRAMS = ocat
ocat_SOURCES = ocat.c ocatlog.c ocatroute.c ocatthread.c ocattun.c ocatv6conv.c ocatcompat.c ocatpeer.c ocatsetup.c ocatipv4route.c ocateth.c ocatsocks.c ocatlibe.c ocatctrl.c ocatipv6route.c ocaticmp.c ocat_wintuntap.c ocat_netdesc.c ocathosts.c ocatresolv.c
noinst_HEADERS = ocat.h ocat_netdesc.h strlcpy.c strlcat.c ocathosts.h
-AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\"
+AM_CFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" -D_PATH_HOSTS=/etc/hosts
install-exec-hook:
24171:20151208:102013.946 Error while sending data to the server [ZBX_TCP_WRITE() failed: [110] Operation timed out]
24171:20151208:102013.946 sending data to server failed: (null)
...
24169:20151208:102225.487 received configuration data from server, datalen
@Ikke
Ikke / filter_recursive.php
Last active December 7, 2015 15:56
Filter recursive
<?php
function filter_recursive($data, $predicate = null)
{
if ($predicate == null) {
$predicate = function ($value) { return !empty($value); };
}
$is_object = false;
if (is_object($data)) {
@Ikke
Ikke / watch_gst.sh
Created September 29, 2015 19:56
Git status that automatically updates
#!/bin/bash
while true;
do
sleep 0.005
ST=$(git -c color.ui=always status -sb);
tput reset;
echo -e "$ST";
#!/bin/bash
file=$1
# Ignore the command this script was run with to prevent infiniute recursion
editor=$(which -a $EDITOR | grep -v $0 | head -n1)
if test -z "$CURRENT_UID"; then
export CURRENT_UID=$UID
fi
@Ikke
Ikke / watch_gst.sh
Created July 24, 2015 11:45
Script that watches changes in a gist repository and show git status
#!/bin/bash
while :
do
clear
git status -sb
inotifywait -qr -e modify -e create -e move -e delete . 2>&1 > /dev/null
sleep 0.3
done
@Ikke
Ikke / build_container.sh
Created February 15, 2015 00:02
Script to build docker images, and (re)create a container based on the image
sudo docker build -t $name .
if [[ $? -gt 0 ]]
then
exit $?
fi
echo -n "Image built, recreate container? [Yn] "
read answer
@Ikke
Ikke / histogram.hs
Last active August 29, 2015 14:11
Creates a vertical histogram of numbers
import Data.List
histogram :: [Int] -> String
histogram xs =
let c = countNumbers xs
h = foldr max 0 c
l = "=========="
n = "0123456789"
g = unlines $ reverse $ transpose $ numbersToStars h c