Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
nice git pull --commit --no-edit | grep 'Already up-to-date' || {
rm -f ninslash_srv
nice bam server_release
[ -e ninslash_srv ] && mv -f ninslash_srv ninslash_srv_run
}
CONFIG=/ctf-
while echo "$CONFIG" | grep '/ctf-' ; do
@pelya
pelya / find_rects.cpp
Last active May 22, 2025 05:40
Find all rectangles in a 2D array, trying to cover as much area with as little amount of rectangles as possible. http://stackoverflow.com/questions/5810649/finding-rectangles-in-a-2d-block-grid
#include <stdlib.h>
#include <vector>
#include <utility>
#include <algorithm>
#include "find_rects.hpp"
namespace FindRects {
/* Algorithm was taken from here: http://stackoverflow.com/a/20039017/624766
diff -u -r --unidirectional-new-file src-old/drivers/usb/gadget/android.c src/drivers/usb/gadget/android.c
--- src-old/drivers/usb/gadget/android.c 2014-06-26 15:26:34.000000000 +0300
+++ src/drivers/usb/gadget/android.c 2016-05-18 21:16:56.637939774 +0300
@@ -51,6 +51,9 @@
#include "f_rndis.c"
#include "rndis.c"
#include "u_ether.c"
+#include "f_hid.h"
+#include "f_hid_android_keyboard.c"
+#include "f_hid_android_mouse.c"
@pelya
pelya / FreePascal with proot 4.0.3.
Created December 2, 2014 20:59
FreePascal with proot crash log
STORAGE -b /storage/emulated/legacy
proot error: can't create temporary directory: No such file or directory
proot error: can't create glue rootfs
proot info: binding = /storage/emulated/legacy
proot info: binding = /system
proot info: binding = /sys
proot info: binding = /proc
proot info: binding = /dev
proot info: binding = /data/data/com.cuntubuntu/files/img:/
proot info: pid 15563: translate("/" + "fpc")
@pelya
pelya / split-normal-diff.sh
Created October 11, 2014 01:07
Split a 'normal' (non-unified) patch file with multiple files into separate small patches
#!/bin/sh
SPLITLINE="diff -r orig/"
[ -n "$1" ] && SPLITLINE="$1"
FILE=
SPLITLEN=`echo $SPLITLINE | wc -c`
while read LINE; do
if echo $LINE | grep "^$SPLITLINE" > /dev/null; then
@pelya
pelya / cnijfilter-source-4.10-1-jessie.patch
Created August 18, 2014 18:59
Patch for Canon Pixma ip2800 drivers to compile on Debian Jessie
diff -u -r cnijfilter-source-4.10-1-old/backend/src/cnij_backend_common.c cnijfilter-source-4.10-1/backend/src/cnij_backend_common.c
--- cnijfilter-source-4.10-1-old/backend/src/cnij_backend_common.c 2013-12-24 06:09:15.000000000 +0200
+++ cnijfilter-source-4.10-1/backend/src/cnij_backend_common.c 2014-08-18 19:20:24.092880785 +0300
@@ -37,6 +37,7 @@
// CUPS Header
#include <cups/cups.h>
#include <cups/ipp.h>
+#include <cups/ppd.h>
// Header file for CANON
diff --git a/code/server/sv_main.c b/code/server/sv_main.c
index 828aa47..b75719d 100644
--- a/code/server/sv_main.c
+++ b/code/server/sv_main.c
@@ -307,9 +307,11 @@ void SV_MasterHeartbeat(const char *message)
{
// if the address failed to resolve, clear it
// so we don't take repeated dns hits
+ // However if there was a temporary network outage,
+ // the server will go offline permanently, so this logic is disabled.