Skip to content

Instantly share code, notes, and snippets.

View likewhoa's full-sized avatar

likewhoa likewhoa

View GitHub Profile
@likewhoa
likewhoa / 1. distro.make
Last active December 16, 2015 16:29
Drupal 7 using Commerce Subscription Products.
api = 2
core = 7.x
projects[drupal][type] = core
projects[drupal][download][type] = git
projects[drupal][download][branch] = 7.x
projects[drupal][download][url] = http://git.drupal.org/project/drupal.git
@likewhoa
likewhoa / slash etc profile
Created August 13, 2013 00:34
A BASH script to show the Sector Size count of drives using smartctl.
chksectorcount() {
local -a drives=(/dev/sd*)
# Iterate through array to remove partitions i.e /dev/sda1 and so on
((n_elements=${#drives[@]}, max_index=n_elements - 1))
for ((i = 0; i <= max_index; i++)); do
if [[ $(echo ${drives[i]} | grep -v '[0-9]') ]]; then
smartctl -a ${drives[i]} | grep "Sector Sizes:"|sed "s:^:${drives[i]} :"
else
# -*- coding:utf8 -*-
import urllib
import curl
import pycurl
import StringIO
def initCurl():
c=pycurl.Curl()
c.setopt(pycurl.FOLLOWLOCATION,0)
queue = Queue.Queue()
out_queue = Queue.Queue()
class ThreadUrl(threading.Thread):
"""Threaded Url Grab"""
def __init__(self, queue, out_queue):
threading.Thread.__init__(self)
self.queue = queue
self.out_queue = out_queue
@likewhoa
likewhoa / ftp.py
Created January 7, 2014 05:43 — forked from newbiethetest/ftp.py
# -*- coding:utf8 -*-
__author__ = 'newbie0086#foxmail.com'
import Queue
import threading
from ftplib import FTP
import os,sys,string,datetime,time
import socket
class MyFtp:
def __init__(self,host,username,password,port=21):
self.host=host
import pycurl
import StringIO
import re
def initCurl():
c=pycurl.Curl()
#c.setopt(pycurl.COOKIEFILE,"cookie_file_name")
#c.setopt(pycurl.COOKIEJAR,"cookie_file_name")
c.setopt(pycurl.FOLLOWLOCATION,0)
c.setopt(pycurl.CONNECTTIMEOUT, 1) #
c.setopt(pycurl.MAXREDIRS,1)
@likewhoa
likewhoa / BS_test.py
Last active January 2, 2016 11:09 — forked from newbiethetest/tes.py
import Queue
import threading
import urllib2
import time
from BeautifulSoup import BeautifulSoup
hosts = ["http://yahoo.com", "http://google.com", "http://amazon.com",
"http://ibm.com", "http://apple.com"]
queue = Queue.Queue()
@likewhoa
likewhoa / Feed me
Last active August 23, 2017 07:18
Command line how to on setting up feeds and feeds_meetup module for Drupal
1.
# cat site.make
core = 7.x
api = 2
projects[drupal][type] = "core"
projects[drupal][download][type] = git
projects[drupal][download][branch] = 7.x
projects[drupal][download][url] = http://git.drupal.org/project/drupal.git
@likewhoa
likewhoa / ecatalyst.sh
Created April 27, 2014 01:58
A script that allows you to chroot into a failed catalyst environment to fix errors manually.
#!/bin/bash
# Help menu
print_help() {
cat <<-HELP
Arguments:
--spec - --spec=stage1.spec (default)
--config - --config=/etc/catalyst.conf (default)
To download changes from an old livedvd iso image to a new one without having to redownload the whole image, do the following.
1. emerge zsync
2. zsync -i oldimage.iso http://releases.gentooligans.com/newimage.iso.zsync