Skip to content

Instantly share code, notes, and snippets.

Mikal mikalv

Block or report user

Report or block mikalv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mikalv
mikalv / .pryrc
Created Aug 21, 2019 — forked from am-kantox/.pryrc
.pryrc
View .pryrc
# === EDITOR ===
Pry.editor = 'vi'
# === PROMPT ===
Pry.prompt = [ ->(obj, nest_level, _) { "" }, ->(obj, nest_level, _) { "#{' ' * nest_level} " } ]
# === COLORS ===
unless ENV['PRY_BW']
Pry.color = true
Pry.config.theme = "railscasts"
@mikalv
mikalv / dispqlen.d
Created Aug 21, 2019 — forked from trptcolin/dispqlen.d
OSX DTrace scripts that didn't work as shipped (run queue related)
View dispqlen.d
#!/usr/sbin/dtrace -s
/*
* dispqlen.d - dispatcher queue length by CPU.
* Written using DTrace (Solaris 10 3/05).
*
* 14-Feb-2006, ver 0.90
*
* USAGE: dispqlen.d # hit Ctrl-C to end sample
*
* NOTES: The dispatcher queue length is an indication of CPU saturation.
@mikalv
mikalv / runq.d
Last active Aug 21, 2019 — forked from trptcolin/runq.d
A DTrace script to print the average, min, and max run queue count by CPU
View runq.d
#!/usr/sbin/dtrace -s
/*
* runq.d - run queue sizes by CPU.
*
* This prints the average, min, and max run queue count by CPU each second. A
* consistently large run queue count is a sign of CPU saturation.
*
* USAGE: runq.d
*
* FIELDS:
@mikalv
mikalv / README.md
Last active Aug 18, 2019 — forked from jclulow/README.md
oddball ps behaviour
View README.md

So, ps is running somewhat slowly...

asgard # time ps -ef | wc -l
     173

real    0m10.195s
user    0m0.023s
sys     0m9.779s
@mikalv
mikalv / dfly-install.org
Created Aug 18, 2019 — forked from liweitianux/dfly-install.org
DragonFly BSD Manual Installation with HAMMER2 and Encrypted Root
View dfly-install.org

DragonFly BSD Installation

2018-01-30

Disk Partition

MBR Slice

root# dd if=/dev/zero of=/dev/vbd0 bs=32k count=16
root# fdisk -IB /dev/vbd0
@mikalv
mikalv / torrents.md
Created Aug 18, 2019 — forked from shmup/torrents.md
transmission blocklist guide
View torrents.md

Transmission Blocklist

The Transmission torrent client has an option to set a Blocklist, which helps protect you from getting caught and having the DMCA send a letter/email.

It's as simple as downloading and installing the latest client:

@mikalv
mikalv / extract_imports.py
Created Aug 17, 2019 — forked from tdudziak/extract_imports.py
A proof-of-concept function that extract import statements from Python bytecode
View extract_imports.py
import dis
import inspect
def extract_imports(code):
"""Returns list of pairs (module_name, from_list) representing imports
from a given code object."""
i = 0
n = len(code.co_code)
IMPORT_NAME = dis.opmap['IMPORT_NAME']
@mikalv
mikalv / forwarder.py
Created Aug 13, 2019 — forked from aculich/forwarder.py
SSHForwarder class for use with the python ssh module: http://pypi.python.org/pypi/ssh
View forwarder.py
#!/usr/bin/env python
# This code is licensed according to the main package that it depends on:
# http://pypi.python.org/pypi/ssh
# License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
# http://www.gnu.org/licenses/lgpl.html
import sys, os, os.path
import select
import SocketServer
@mikalv
mikalv / moddep.py
Created Aug 13, 2019 — forked from hsun/moddep.py
Generates dot file for python dependencies in a package
View moddep.py
#!/usr/bin/env python
import _ast, ast
import argparse
import colorsys
import logging
import md5
import os.path
import sys
View screenify.sh
#!/bin/bash
#
# Trick process(es) to talk to current terminal
#
# Copyright (c) 2004, 2005 Timo Lindfors <timo.lindfors@iki.fi>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
You can’t perform that action at this time.