Skip to content

Instantly share code, notes, and snippets.

View schnell18's full-sized avatar

Justin Zhang schnell18

View GitHub Profile
@schnell18
schnell18 / check_set_sem.sh
Created April 8, 2014 01:55
Check and set Linux kernel semaphores
# cat /proc/sys/kernel/sem
250 32000 32 128
# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 100
max ops per semop call = 32
semaphore max value = 32767
@schnell18
schnell18 / cgitrc-sample
Created April 10, 2014 14:59
cgitrc sample file with instruction to generate absolute link URL starting with /cgit.cgi/
# Make cgit generate link using absolute URL
virtual-root=/cgit.cgi/
# Enable caching of up to 1000 output entriess
cache-size=1000
# cache time to live
cache-dynamic-ttl=5
cache-repo-ttl=5
@schnell18
schnell18 / cgit_nginx_enabling
Last active August 29, 2015 13:58
Key config to make cgit work under nginx
# The .css and image files required by CGit should be copied to /var/www/cgit-css
# as nginx concat the matched URI with the document root which is very different
# from Apache's Alias directive.
location /cgit-css {
root /var/www;
index index.html index.htm;
}
# The cgit.cgi program does not work if the whole URI is passed as PATH_INFO.
# Strip the CGI program name from URI and set PATH_INFO to the remaining part,
@schnell18
schnell18 / sqlite3_compare.sql
Last active August 29, 2015 13:59
Sample queries to demonstrate type affinity and type conversion in comparison expression
CREATE TABLE t1(
a TEXT, -- text affinity
b NUMERIC, -- numeric affinity
c BLOB, -- no affinity
d -- no affinity
);
-- Values will be stored as TEXT, INTEGER, TEXT, and INTEGER respectively
INSERT INTO t1 VALUES('500', '500', '500', 500);
SELECT typeof(a), typeof(b), typeof(c), typeof(d) FROM t1;
@schnell18
schnell18 / gitolite_nginx_integration
Created April 14, 2014 14:35
nginx working configure to serve gitolite via http
# enable git smart http transport via gitolite
location /git {
# turn off gzip as git objects are already well compressed
gzip off;
# use file based basic authentication
auth_basic "Git Repository Authentication";
auth_basic_user_file /opt/git/htpasswd;
# common FastCGI parameters are required
@schnell18
schnell18 / gitolite_cgit_ldap_nginx_integration.txt
Last active June 12, 2019 02:50
working nginx config to integrate Gitolite, cgit and LDAP.
ldap_server auth1 {
url "ldap://vmcentos64:389/ou=Users,ou=Accounts,dc=acme,dc=com?cn?sub?(objectClass=*)";
binddn "cn=manager,dc=acme,dc=com";
binddn_passwd password;
group_attribute cn;
group_attribute_is_dn on;
require valid_user;
}
#
@schnell18
schnell18 / sample.spec
Created April 20, 2014 15:53
Template RPM spec file
Summary: The world famous foo
Name: foo
Version: 1.03
Release: 1
License: GPL
Group: Applications/System
Source0: foo-%{version}.tar.bz2
Source1: foo.sysvinit
Patch0: foo-fix1.patch
Patch1: foo-fix2.patch BuildRoot: /var/tmp/%{name}-root
mount -t cifs -o "user=xyz,domain=abc" //host1/archive /mnt/foler1
@schnell18
schnell18 / nginx-mod.spec
Created April 26, 2014 14:14
nignx 1.4.7 modified spec file to support LDAP authentication
#
%define nginx_home %{_localstatedir}/cache/nginx
%define nginx_user nginx
%define nginx_group nginx
# distribution specific definitions
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7)
%if 0%{?rhel} == 5
Group: System Environment/Daemons
@schnell18
schnell18 / gitolite3-custom.spec
Created April 26, 2014 14:28
Customized gitolite3 spec file to use 'git' as hosting user
%global perl_vendorlib %(eval $(perl -V:vendorlib); echo $vendorlib)
# RHEL uses %%{_prefix}/com for %%{_sharedstatedir} instead of /var/lib
%if 0%{?rhel}
%global gitolite_homedir /var/lib/%{name}
%else
%global gitolite_homedir %{_sharedstatedir}/%{name}
%endif
%define os_user git