Skip to content

Instantly share code, notes, and snippets.

[Unit]
Description=App Redis Sidekick
Requires=docker.service
Requires=etcd.service
After=docker.service
After=etcd.service
After=app-redis.service
BindsTo=app-redis.service
@mkdizajn
mkdizajn / wordpress plugin rewrite media path
Created December 11, 2012 11:09
wordpress plugin rewrite media path
<?php
/*
Plugin Name: Rewrite Wordpress upload path
Plugin URI: http://mkdizajn.com
Description: Rewrites your image paths.
Version: 2.4
Author: kreso
Author URI: http://mkdizajn.com/
*/
@coffeesnake
coffeesnake / serve.py
Created July 11, 2012 21:19
quick'n'dirty multithreaded wsgiref sample
from wsgiref.simple_server import make_server, WSGIServer
from SocketServer import ThreadingMixIn
from time import sleep
def simple_app(env, start_response):
status = '200 OK'
headers = [('Content-type', 'text/plain')]
start_response(status, headers)
@sandcastle
sandcastle / GeoData.cs
Created May 4, 2016 14:30
A Unity 3D behaviour for Geo location lookup via IP address
using UnityEngine;
using System.Collections;
using Newtonsoft.Json;
/// <summary>
/// The Geo data for a user.
///
/// http://ip-api.com/docs/api:json
///
@ianmackinnon
ianmackinnon / match.c
Created August 8, 2012 12:01
C Regex multiple matches and groups example
# gcc -Wall -o match match.c && ./match
#
#include <stdio.h>
#include <string.h>
#include <regex.h>
@fritsstegmann
fritsstegmann / Setup Redis 6 with TLS on Ubuntu 18.04.md
Last active January 5, 2024 18:50
Setup Redis 6 with TLS
On Ubuntu 18.04
@jobliz
jobliz / RedisPythonPubSub1.py
Created May 4, 2012 17:58
A short script exploring Redis pubsub functions in Python
import redis
import threading
class Listener(threading.Thread):
def __init__(self, r, channels):
threading.Thread.__init__(self)
self.redis = r
self.pubsub = self.redis.pubsub()
self.pubsub.subscribe(channels)
@jyap808
jyap808 / Nginx Virtual Host Log Format.md
Created April 13, 2014 05:03
Nginx Virtual Host Log Format
$ diff -u /etc/nginx/nginx.conf{.ORIG,}
--- /etc/nginx/nginx.conf.ORIG  2014-04-13 04:15:51.907316500 +0000
+++ /etc/nginx/nginx.conf       2014-04-13 05:02:22.807316500 +0000
@@ -30,7 +30,9 @@
        # Logging Settings
        ##
 
-       access_log /var/log/nginx/access.log;
+ log_format vhosts '$host $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
@sem1h
sem1h / Quaternion vs Euler Angles in Unity [TR].md
Last active February 14, 2024 10:14
Quaternion vs Euler Angles in Unity (Turkish)

Unity'de 3D çalışırken kafa kurcalayan konulardan biri Quaternion'ların ne işe yaradığı ve neden bazı yerlerde rotasyon değeri olarak Euler Angle değil de Quaternion kullanıldığıdır.

3 Boyutlu rotasyon belirtmek için kullanılan Euler Açısı, bir 3x3 rotasyon matrisi ile ifade edilebiliyor. Örnek:

Euler Açısı

İdeal bir sistemde her bir rotasyon matrisinin, yalnızca tek açıya isabet etmesini isteriz. Sorun şu ki bu matrisler, her zaman için tek açıya tekabül etmeyebiliyor.

@paulsmith
paulsmith / echo.go
Created January 12, 2011 06:09
A simple echo server testing a few interesting Go language features, goroutines and channels.
// $ 6g echo.go && 6l -o echo echo.6
// $ ./echo
//
// ~ in another terminal ~
//
// $ nc localhost 3540
package main
import (