Skip to content

Instantly share code, notes, and snippets.

View denji's full-sized avatar
🇺🇦

Denis Denisov denji

🇺🇦
View GitHub Profile
#######################################################
### nginx default maps
#######################################################
###
### Support separate Boost and Speed Booster caches for various mobile devices.
###
map $http_user_agent $device {
default normal;
~*Nokia|BlackBerry.+MIDP|240x|320x|Palm|NetFront|Symbian|SonyEricsson mobile-other;

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

@denji
denji / safe-rm.md
Last active August 29, 2015 13:56
FreeBSD safe-rm and root dir

Safe-rm is a safety tool intended to prevent the accidental deletion of important files by replacing /bin/rm with a wrapper

$ portmaster sysutils/safe-rm
$ echo "/" >> /etc/safe-rm.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@denji
denji / install-fish-shell-mac-ubuntu.md
Created March 6, 2014 08:17
Install Fish Shell on Mac OS X and Ubuntu

Install Fish Shell on Mac OS X and Ubuntu

Source: http://hackercodex.com/guide/install-fish-shell-mac-ubuntu/

The Fish shell goes where few command-line shells have gone before, shedding its forebearers’ POSIX baggage in favor of simplicity, consistency, and ease-of-use. Much like the Mac creators thought computers should be made to understand how humans work (and not the other way around), Fish observes your past behavior and suggests commands that it thinks you might be trying to execute. Sometimes, those suggestions are so spot-on that it can be downright spooky. Reactions of “How did Fish know that’s what I wanted to do?” are not uncommon.

In this article, we’re going to show how to install the recently-released Fish 2.1.0 on Mac OS X and Ubuntu, followed by some basic setup steps. Subsequent posts will cover more advanced configuration.

So can a command-line shell be Mac-like? Let’s find out.

@denji
denji / memcache_connection_state_3.0.8.diff
Created March 7, 2014 16:42
memcache-3.0.8: Force closing persistent connection
diff --git memcache-3.0.8/memcache.c memcache-3.0.8/memcache.c
index 0356359..d8a4f2d 100644
--- memcache-3.0.8/memcache.c
+++ memcache-3.0.8/memcache.c
@@ -710,6 +710,8 @@ mmc_t *mmc_find_persistent(const char *host, int host_len, unsigned short port,
key_len = spprintf(&key, 0, "memcache:server:%s:%u:%u", host, port, udp_port);
+retry_lookup:
+
@denji
denji / dev-dns.pac
Created March 23, 2014 22:46
Demo proxy for Mac Developer
function FindProxyForURL(url, host)
{
if ((host == "localhost") ||
(shExpMatch(host, "localhost.*")) ||
(host == "127.0.0.1")) {
return "DIRECT";
}
if (dnsDomainIs(host, ".dev")) {
return "PROXY localhost";
webserver: webserver.c libuv/uv.a http-parser/http_parser.o
gcc -I libuv/include \
-lrt -lm -lpthread -o \
webserver webserver.c \
libuv/uv.a http-parser/http_parser.o
libuv/uv.a:
$(MAKE) -C libuv
http-parser/http_parser.o:
aria2c \
--continue=true \
--log=/home/ratazzi/aria.log \
--log-level=warn \
--seed-time=0 \
--file-allocation=none \
--human-readable=false \
--allow-overwrite=true \
--always-resume=true \
--bt-hash-check-seed=false \
@denji
denji / FindC99.cmake
Created April 3, 2014 16:41
Find C99 and C++11
# - Module that checks for supported C99 features.
# macro to only add option once
include (AddOptions)
# try to use compiler flag -std=c99
set (C_STD99_FLAGS "-std=c99")
# incidently, the C++ test is so simple that it can be used to compile C as well
include (CheckCCompilerFlag)