Skip to content

Instantly share code, notes, and snippets.

View maretekent's full-sized avatar

kent marete maretekent

  • http://glosoftgroup.com
  • Nairobi Kenya
View GitHub Profile
@maretekent
maretekent / codeiginter-server-config.md
Created January 13, 2020 23:50 — forked from yidas/codeiginter-server-config.md
Codeigniter 3 server configuration for Nginx & Apache

Codeigniter 3 server configuration for Nginx & Apache

Web Server Site Configuration

Recommended Apache Configuration

Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot and ServerName fit to your environment:

@maretekent
maretekent / CodeMonk#pg_backup.bat
Created February 20, 2019 09:57 — forked from CodMonk/CodeMonk#pg_backup.bat
Batch file to backup PostgreSQL DB
@echo off
goto comment
Author: Code Monk
Description: This file use to backup the database using PostgreSQL backup utility "pg_dump".
Backup parameters should be setup before executing this file
File Format flags :
c = Custom
t = Tar
@maretekent
maretekent / gist:cd39b3da62488fbe05e5ccf6d550d1e9
Created September 15, 2018 08:24 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@maretekent
maretekent / ad_test.py
Created September 5, 2018 20:57 — forked from caseydunham/ad_test.py
Retrieve user information from AD via Python LDAP
import sys, ldap
# DN = [email protected], secret = password, un = username
DN, secret, un = sys.argv[1:4]
server = "ldap://server.com"
port = 389
base = "dc=example,dc=com"
scope = ldap.SCOPE_SUBTREE
def find(key, dictionary):
for k, v in dictionary.iteritems():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
for d in v:
for result in find(key, d):
@maretekent
maretekent / main.rs
Created July 2, 2018 15:54 — forked from hitman401/main.rs
Producer Consumer Sample in RUST
use std::sync::{Arc, Mutex, Condvar};
use std::thread;
struct Producer {
cvar: Arc<(Mutex<bool>, Condvar)>
}
impl Producer {
pub fn new(cvar: Arc<(Mutex<bool>, Condvar)>) -> Producer {
Producer {
@maretekent
maretekent / example.js
Created June 9, 2018 16:39 — forked from tjenkinson/example.js
Get the base url to a react router route handler.
import React from 'react'
import { Link } from 'react-router'
import getRouteHandlerBaseUrl from 'js/helpers/get-route-handler-base-url'
class Something extends React.Component {
componentWillMount() {
this._baseUrl = getRouteHandlerBaseUrl(this.props)
}
@maretekent
maretekent / playground.rs
Created May 4, 2018 09:34 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#[warn(unused_variables)]
#[warn(unused_must_use)]
use std::thread;
fn main(){
let mut c = vec![];
for i in 0..10{
c.push(thread::spawn(move || {
println!("thread number {}", i);
@maretekent
maretekent / control.rs
Created April 24, 2018 17:50 — forked from therustmonk/control.rs
Rust thread control
use std::time::Duration;
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::thread;
fn main() {
// Play with this flag
let fatal_flag = true;
let do_stop = true;