Skip to content

Instantly share code, notes, and snippets.

@khapota
khapota / gist:2ceda9bac90a882ed74f
Last active August 29, 2015 14:04
Mosquitto br
#
# mosquitto birdge client config
#
#name of master mosquitto
connection main
#address of master mosquitto
address 127.0.0.1
start_type automatic
#id of master mosquitto (any id is accepted)
clientid m-br
@khapota
khapota / gist:d6ea6cecc8a57e9eb701
Created August 1, 2014 07:22
OpenVPN Performance
tun-mtu 6000
fragment 0
mssfix 0
cipher aes-256-cbc
@khapota
khapota / gist:0a0f5c625e7e40cc9d81
Created August 25, 2014 16:34
PHP LDAP Authentication sample
<?php
// LDAP variables
$ldaphost = ""; // your ldap servers
$ldapport = 389; // your ldap server's port number
// Connecting to LDAP
$ldapconn = ldap_connect($ldaphost, $ldapport)
or die("Could not connect to $ldaphost");
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ldapconn) {
@khapota
khapota / tmuxinator.yml
Created January 28, 2016 08:20
tmuxinator profile with specific layout
# ~/.tmuxinator/general.yml
name: general
root: ~/
# Optional tmux socket
# socket_name: foo
# Runs before everything. Use it to start daemons etc.
# pre: sudo /etc/rc.d/mysqld start
@khapota
khapota / runITerm2.scpt
Last active February 19, 2016 04:51
Open some general tabs and do maximum window
-- get screen resolution
-- Finder method does not work with 10.11
set screenWidth to (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print $2}'")
set screenHeight to (do shell script "system_profiler SPDisplaysDataType | awk '/Resolution/{print $4}'")
-- Kill old iTerm2
-- added exit 0 to by pass error code when process did not exist.
do shell script "killall -9 iTerm2; exit 0"
-- get dock size
@khapota
khapota / redmine_textile2md.rb
Created February 25, 2016 07:50 — forked from yuumi3/redmine_textile2md.rb
Convert Textile to Markdown contents in Redmin
def textile_to_markdown(textile)
d = []
pre = false
table_header = false
text_line = false
textile.each_line do |s|
s.chomp!
@khapota
khapota / call_func_method.py
Created February 25, 2016 07:54
Python note
#Assuming module foo with method bar:
import foo
methodToCall = getattr(foo, 'bar')
result = methodToCall()
#As far as that goes, lines 2 and 3 can be compressed to:
result = getattr(foo, 'bar')()
#https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-from-a-string-with-the-functions-name-in-python
@khapota
khapota / .screenrc
Last active February 26, 2016 01:49 — forked from rpherrera/.screenrc
Personal Config
altscreen on
term screen-256color
bind ',' prev
bind '.' next
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%s%{-}'
@khapota
khapota / notify.py
Last active March 9, 2016 01:50
Telegram CLI (tg) mac os notify script
import tgl
import os
# This is a python script that run with tg and notify when get new message
# Using terminal-notifier https://github.com/julienXX/terminal-notifier
# The notifier function
def notify(title, subtitle, message):
t = '-title "%s"' % title
s = '-subtitle "%s"' % subtitle
@khapota
khapota / sources.list
Created March 30, 2016 08:32
debian 7 source list
deb http://debian.xtdv.net/debian/ wheezy main contrib non-free