Skip to content

Instantly share code, notes, and snippets.

View UlasSAYGINIM's full-sized avatar

Ulaş SAYGIN UlasSAYGINIM

View GitHub Profile
@cypres
cypres / daemon.cc
Created April 2, 2014 08:49
C++ example daemon with fork and relaunch should child die. Required C++11, gflags and glog.
//
// Copyright (C) 2011-2012 Yaroslav Stavnichiy <[email protected]>
// Copyright (C) 2014 OnlineCity Aps <[email protected]>
//
// Inspired by: https://bitbucket.org/yarosla/nxweb/src/tip/src/lib/daemon.c
//
// Licensed under The MIT License:
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@clemensg
clemensg / etc_make.conf
Last active June 1, 2020 21:37
My FreeBSD make.conf
# /etc/make.conf
# Clemens Gruber, 2017
#
# Nearby mirror
#MASTER_SITE_OVERRIDE="ftp://ftp.at.freebsd.org/pub/FreeBSD/ports/distfiles/"
#MASTER_SITE_OVERRIDE="ftp://ftp.de.freebsd.org/pub/FreeBSD/ports/distfiles/"
# Build
MAKE_JOBS_NUMBER?=8
@janikvonrotz
janikvonrotz / Install Ghost Blog.md
Created January 21, 2014 15:20
Step by Step: Install Ghost Blog #Ghost #Ubuntu #Markdown #Nginx #Node.js #AmazonAWS

Finishing this guide you'll get:

  • A running Ghost installation
  • Amazon SES mail configuration
  • Simple ssh hardenings
  • Nginx proxy
  • Node.js configured with forever

Specification of latest running installation:

@sergeylukin
sergeylukin / make.conf
Created November 19, 2013 15:08
Optimized system-wide makefile for FreeBSD. Saved in /etc/make.conf
# default to -j6 for make
FORCE_MAKE_JOBS=yes
MAKE_JOBS_NUMBER=6
# specific options/etc for ports
.if ${.CURDIR:M*/databases/mysql*-server}
BUILD_OPTIMIZED=yes
.endif
# static zsh build for root
@takeshixx
takeshixx / contab-jails.sh
Last active February 22, 2022 22:37
Crontab script for FreeBSD Jails (update seperate ports tree, run portaudit, check for port updates)
#!/usr/local/bin/zsh
JAIL_PORTS=/usr/jails/ports
SHELL=/usr/local/bin/zsh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
SECTION=' * * * * * * '
DELIMITER='------------------------------'
portsnap -p $JAIL_PORTS fetch extract &>/dev/null || echo "Updating ports tree failed!"
echo "# VULNERABILITIES"
@btbytes
btbytes / base36_encode_decode.sql
Created October 25, 2013 18:53
Base36 Conversion in PostgreSQL
-- source: http://www.jamiebegin.com/base36-conversion-in-postgresql/
CREATE OR REPLACE FUNCTION base36_encode(IN digits bigint, IN min_width int = 0)
RETURNS varchar AS $$
DECLARE
chars char[];
ret varchar;
val bigint;
BEGIN
chars := ARRAY['0','1','2','3','4','5','6','7','8','9'
,'A','B','C','D','E','F','G','H','I','J','K','L','M'
@timkofu
timkofu / pf.conf
Last active March 1, 2022 12:34
FreeBSD transparent proxy with PF + Squid
# Squid should be intercepting on port 2600
# A cachaing dns server should be running on this box, with squid and clients all resolving through it.
# FreeBSD 9.2 RELEASE + Squid 3.3.9 from ports
# Timothy Makobu, 2013
# Variables
admin_if = "igb0"
external_if = "igb1"
intraservices = "{ 22, 2600, 53 }"
forward_ports = "{ 443, 465, 6667, 22, 587, 5938, 2083, 2082, 2095, 2096, 5242, 4244, 5243, 9785 }"
@plentz
plentz / nginx.conf
Last active April 19, 2025 04:46
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@killercup
killercup / newsyslog.conf
Last active September 30, 2019 03:21
FreeBSD logrotate via /etc/newsyslog.conf
/var/log/nginx-access.log 644 7 1024 * JC /var/run/nginx.pid 30
/var/log/nginx-error.log 644 7 1024 * JC /var/run/nginx.pid 30
/home/app/episodefever/shared/log/unicorn.stdout.log app:app 666 7 1024 * JC
/home/app/episodefever/shared/log/unicorn.stderr.log app:app 666 7 1024 * JC
/home/app/episodefever/shared/log/newrelic_agent.log app:app 666 7 1024 * JC
/home/app/episodefever/shared/log/production.log app:app 666 7 1024 * JC /usr/home/app/episodefever/shared/pids/unicorn.pid 30
/home/app/episodefever/shared/log/resque-pool.stdout.log app:app 666 7 1024 * JC /usr/home/app/episodefever/shared/pids/resque-pool.pid 30
/home/app/episodefever/shared/log/resque-pool.stderr.log 666 7 1024 * JC /usr/home/app/episodefever/shared/pids/resque-scheduler.pid 30
@denvazh
denvazh / gitlab
Last active September 6, 2019 03:43
Freebsd port of script to manage gitlab as system service.
#!/bin/sh
#
# Written by Denis Vazhenin <[email protected]>
#
# This script was ported from Debian/Ubuntu version of start script for Gitlab:
# https://raw.github.com/gitlabhq/gitlabhq/master/lib/support/init.d/gitlab
#
# PROVIDE: gitlab
# REQUIRE: NETWORKING SERVERS DAEMON LOGIN
# KEYWORD: shutdown