Skip to content

Instantly share code, notes, and snippets.

View bogtan's full-sized avatar

Bogdan Tănase bogtan

View GitHub Profile
@bogtan
bogtan / Useful commands
Last active January 3, 2016 07:58
A list with useful commands
# In OpenLDAP 2.4.23, when running an ldapsearch and the results have large text entries,
# the results is wrapped at column 76 and the -o ldif-wrap=no option is no longer available
# so we need to pipe the output and remove the wrap
# Basic example
ldapsearch -x -LLL "(objectClass=<your_object_class>)" dn | perl -p00e 's/\r?\n //g'
@bogtan
bogtan / grc.sh
Last active August 29, 2015 13:55
Execute git command on multiple repositories in same directory.
#!/bin/bash
if [ ! "$1" = "" ] ; then
if [ "$REPOSITORIES" = "" -a -d "$PWD" ] ; then
REPOSITORIES="$PWD"
fi
if [ "$REPOSITORIES" != "" ] ; then
echo "Git repositories found in $REPOSITORIES"
echo ""
@bogtan
bogtan / tomcat7
Created February 4, 2014 09:44
Tomcat7 Start/Stop script. (With small changes from http://blog.maestropublishing.com/2013/04/23/tomcat7-service-startstop-script/)
#!/bin/bash
# Description: This shell script takes care of starting and stopping Tomcat
TOMCAT_HOME=$(brew --prefix tomcat)/bin
SHUTDOWN_WAIT=20
tomcat_pid() {
echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}
@bogtan
bogtan / messages_notifications.sh
Created February 5, 2014 10:37
Restart notifications for Messages on OS X
launchctl unload /System/Library/LaunchAgents/com.apple.soagent.plist
launchctl load /System/Library/LaunchAgents/com.apple.soagent.plist
<!-- Tab sets have to have an id set -->
<div class="tabs" id="mytab1">
<ul class="nav nav-tabs">
<li><a href="#tab1">Tab 1</a></li>
<li><a href="#tab2">Tab 2</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane" id="tab1">
Content for tab 1
</div>
class Color(object):
"""
utility to return ansi colored text.
"""
colors = {
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@bogtan
bogtan / head.html
Created March 12, 2014 15:15
HTML meta tags for social sharing and Apple devices
<!-- Standard Favicon -->
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<!-- For iPhone 4 Retina display: -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://www.example.com/apple-touch-icon-114x114.png">
<!-- For iPad: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://www.example.com/apple-touch-icon-72x72.png">
<!-- For iPhone: -->
<link rel="apple-touch-icon-precomposed" href="http://www.example.com/apple-touch-icon-57x57.png">
<!-- Facebook -->
@bogtan
bogtan / rts_bpp.sh
Created June 10, 2014 08:59
SD card reader in Debian Wheezy
#!/bin/sh
wget https://bugs.launchpad.net/bugs/971876/+attachment/2991730/+files/rts_bpp.tar.bz2
tar jxf rts_bpp.tar.bz2
cd rts_bpp
make
su -c 'make install ; modprobe rts_bpp ; depmod -a'
""" Simple youtube downloader """
import re
import sys
import requests
import urllib
def youtube_info(youtube_id):
""" Raises ValueError when video is not streamable - e.g. VEVO video """
info_url = 'http://www.youtube.com/get_video_info?video_id={0}'