Skip to content

Instantly share code, notes, and snippets.

View KnightKu's full-sized avatar

Gu Zheng KnightKu

  • Nanjing
View GitHub Profile
@KnightKu
KnightKu / rmdisk.sh
Created December 24, 2015 06:12 — forked from tommybutler/rmdisk.sh
Force a disk offline and power it down in Linux
#!/bin/bash
# AUTHOR: Tommy Butler
#
# DESCRIPTION:
# Run this script to offline and delete a disk from your Linux system.
# It should work for most people, but if you've got an old kernel it may not.
# Unless you know what you're doing, DO NOT USE THIS SCRIPT!
#
# LICENSE: Perl Artistic License - http://dev.perl.org/licenses/artistic.html
@KnightKu
KnightKu / fetch_debs_from_jenkins.py
Created December 8, 2015 07:42 — forked from supertom/fetch_debs_from_jenkins.py
download artifacts from jenkins with python
#!/usr/bin/env python
import cStringIO
import json
import pycurl
import os
import sys
##########
# configuration
@KnightKu
KnightKu / pre-commit
Last active August 29, 2015 14:24 — forked from temoto/pre-commit
#!/bin/bash
set -e
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile
@KnightKu
KnightKu / pre-commit
Last active August 29, 2015 14:24 — forked from jlnwlf/pre-commit
#!/bin/bash
autopep=$(autopep8 -dr .)
if [[ -z $autopep ]]
then
echo "> PEP8 passed !"
else
echo "> PEP8 DID NOT pass !"
echo "$autopep" | colordiff
@KnightKu
KnightKu / pre-commit
Last active August 29, 2015 14:24 — forked from temoto/pre-commit
#!/bin/bash
set -e
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
@KnightKu
KnightKu / jenkins.py
Last active August 29, 2015 14:24 — forked from dnozay/jenkins.py
# some servers do not send "401 retry" responses when authentication is needed
# and return "403 forbidden" instead; e.g. jenkins does that.
import urllib2
import logging
# configure logging for library
class NullHandler(logging.Handler):
def emit(self, record):
pass