This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(unused_variables, unused_mut, dead_code)] | |
#[derive(Debug)] | |
enum Shot { | |
// 3 classifications of accuracy for the Shot | |
Bullseye, | |
Hit(f64), | |
Miss, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
directories=("/path/to/dir1" "/path/to/dir2") | |
for i in ${directories[@]}; | |
do | |
if [ -d $i ] | |
then | |
echo "$i is around" | |
rm -fr $i |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -x | |
snapshot(){ | |
now=$(date +%F_%H:%M:%S) | |
ps -e -o user,uid,pid,ppid,class,rtprio,ni,pri,psr,c,pcpu,pmem,vsz,rss,start,time,etime,stat,wchan=wwwwwwwwwwwwwwwwwwwwww,cmd --sort=user | grep -Evi 'root|bash|ssh' > $where/process_$now.log; | |
} | |
go(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import grp | |
import json | |
import logging | |
import optparse | |
import os | |
import pwd | |
import re | |
import subprocess |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in `find . -maxdepth 1 -mindepth 1 -type d`; do cd $i; git pull; cd ..; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$#" < "2" || "$#" > "3" ]]; then | |
cat <<END | |
Glusterfs GFID resolver -- turns a GFID into a real file path | |
Usage: $0 <brick-path> <gfid> [-q] | |
<brick-path> : the path to your glusterfs brick (required) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# All SSH libraries for Python are junk (2011-10-13). | |
# Too low-level (libssh2), too buggy (paramiko), too complicated | |
# (both), too poor in features (no use of the agent, for instance) | |
# Here is the right solution today: | |
import subprocess | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BankAccount(object): | |
"""docstring for BankAccount""" | |
def __init__(self, amount = 0.0): | |
self.balance = float(amount) | |
self.history = {} | |
self.recordhistory("Account Open", amount = self.balance, balance = self.balance) | |
def __repr__(self): | |
return repr(self.balance) | |