Skip to content

Instantly share code, notes, and snippets.

View nixmaniack's full-sized avatar

Muneeb Shaikh nixmaniack

View GitHub Profile
@nixmaniack
nixmaniack / open-custom.el
Created March 4, 2016 10:43
Open in appropriate browser based on URL
(setq
browse-url-chromium-program "/opt/homebrew-cask/Caskroom/google-chrome/latest/Google Chrome.app/Contents/MacOS/Google Chrome"
browse-url-firefox-program "/opt/homebrew-cask/Caskroom/firefox/41.0.1/Firefox.app/Contents/MacOS/firefox")
(defun my-browse-url-maybe-privately (url &optional new-window)
"Ask whether URL should be browsed in a private browsing window."
(interactive "sURL: ")
(if (y-or-n-p "Private Browsing? ")
(my-browse-url-chrome-privately url)
(browse-url-default-browser url new-window)))
@nixmaniack
nixmaniack / extending_lvm_volume.org
Created December 16, 2014 11:08
Extend LVM Volume

Extending Logical Volume in LVM

  1. Add volume
  2. fdisk /dev/volume
  3. Make primary partition with type 8e(lvm)
    • # echo -e “n\np\n1\n\n\nt\n8e\nw\n” | fdisk /dev/volume
  4. pvcreate /dev/volume1
  5. vgextend volumegroupname /dev/volume1
  6. lvextend -l +100%FREE /full/vg/lv/path
  7. resize2fs /full/vg/lv/path
@nixmaniack
nixmaniack / ipython.py
Created February 14, 2012 15:57
Testing in IPython
cmd = 'dict surprise'
fi, fo, fe = os.popen3(cmd)
for i in fo.readlines():
print i,
@nixmaniack
nixmaniack / dictbot.py
Created February 14, 2012 15:51
Dictionary Bot for XChat (Plugin)
1 #!/usr/bin/env python
2
3 __module_name__ = "DictBot"
4 __module_version__ = "0.1"
5 __module_description__ = "DictBot by Muneeb"
6
7 import xchat
8 import os
9
10
@nixmaniack
nixmaniack / dictbot.py
Created February 14, 2012 13:16
Dictionary Bot for XChat (Plugin)
#!/usr/bin/env python
__module_name__ = "DictBot"
__module_version__ = "0.1"
__module_description__ = "DictBot by Muneeb"
import xchat
import os
@nixmaniack
nixmaniack / xmppgtalk.py
Created February 8, 2012 16:46
GTalk XMPP Python
import xmpp
GMAIL_ID = 'yourid@gmail.com'
PASS = 'yourpass' # if you have app specific pass, you'll need to generate one for this
jid = xmpp.protocol.JID(GMAIL_ID)
C = xmpp.Client(jid.getDomain(), debug=['always'])
if not C.connect(("talk.google.com",5223)):
raise IOError('Can not connect')
if not C.auth(jid.getNode(),PASS):
raise IOError('Can not auth with server')
@nixmaniack
nixmaniack / README
Created November 30, 2011 20:07 — forked from mrspeaker/README
AI Class playlist generator
These are the scripts I use to create the playlists for the AI Class (available here: http://www.mrspeaker.net/2011/10/26/ai-class-playlists/). It's not pretty, but it works. I put them up here due to popular demand.
The first stage is to grab the video list HTML from YouTube and extract/sort the videos. This is done with the Video_ID_scraper.html file (instructions there).
Next, paste the video info into the YouTube_Playlist_Uploader.py script and it generates the playlist. It relies on the GData APIs so you need a dev key etc.
Any questions to mrspeaker@gmail.com
@nixmaniack
nixmaniack / ai-class.py
Created November 30, 2011 19:54
Download lecture videos of ai-class (with Subtitles) (Stanford)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Deepak.G.R."
__license__ = 'Public Domain'
"""
usage:
Go to command line and type
python ai-class.py "topic-name"