Skip to content

Instantly share code, notes, and snippets.

View n0ts's full-sized avatar
🏠
Working from home

Naoya Nakazawa n0ts

🏠
Working from home
  • Freelancer
  • Tokyo, Japan
  • X @n0ts
View GitHub Profile
@n0ts
n0ts / gist:11359549
Created April 28, 2014 01:17
usbhid.sh
#!bin/sh
echo -n "5-1:1.0" > /sys/bus/usb/drivers/usbhid/unbind
echo -n "5-1:1.0" > /sys/bus/usb/drivers/usbrh/bind
echo -n "5-2:1.0" > /sys/bus/usb/drivers/usbhid/unbind
echo -n "5-2:1.0" > /sys/bus/usb/drivers/usbrh/bind
ls /proc/usbrh
@n0ts
n0ts / gist:11243060
Created April 24, 2014 05:56
/etc/supervisord.conf
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
;port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
;username=user ; (default is no username (open server))
@n0ts
n0ts / gist:10712912
Created April 15, 2014 08:13
256_colors.sh
# show 256 terminal colors
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
@n0ts
n0ts / gist:10645605
Created April 14, 2014 12:59
tomahawk on CentOS 5
$ tomahawk -h h1 uptime
Traceback (most recent call last):
File "/usr/bin/tomahawk", line 4, in ?
from pkg_resources import require; require('tomahawk==0.7.0')
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 2479, in ?
working_set.require(__requires__)
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 585, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 483, in resolve
num calls time self name
-----------------------------------------------------------------------------------
1) 1 205.59 205.59 71.91% 205.59 205.59 71.91% rbenv
2) 4 40.86 10.21 14.29% 40.86 10.21 14.29% compaudit
3) 2 79.44 39.72 27.79% 38.58 19.29 13.50% compinit
4) 1 0.29 0.29 0.10% 0.29 0.29 0.10% bashcompinit
5) 2 0.22 0.11 0.08% 0.22 0.11 0.08% compdef
6) 1 0.21 0.21 0.07% 0.21 0.21 0.07% is-at-least
7) 1 0.16 0.16 0.05% 0.07 0.07 0.03% complete
8) 1 0.05 0.05 0.02% 0.05 0.05 0.02% exists
@n0ts
n0ts / get_chef_packages.rb
Created February 10, 2014 12:39
Get Chef Packages
#
# get_packages.rb <el5|el6|deb>
#
require 'net/http'
require 'rexml/document'
case ARGV[0]
when 'el5', 'el6', 'deb'
package = ARGV[0]
else
@n0ts
n0ts / gennerate_passwd.py
Created February 7, 2014 07:22
Generate password
from crypt import crypt
from random import choice
import string
import sys
salt_pop = string.letters + string.digits + '.' + '/'
salt = ''
for i in range(8):
salt = salt + choice(salt_pop)
@n0ts
n0ts / disable_service_centos6.sh
Last active January 4, 2016 13:58
Disable Service for CentOS 6 on VM
while read SERVICE
do
service $SERVICE stop
chkconfig $SERVICE off
done << EOL
ip6tables
iptables
netfs
EOL
@n0ts
n0ts / install-vmware-tools.sh
Last active December 6, 2019 01:50
Install vmware tools
#!bin/bash
mkdir /mnt/cdrom
mount -r /dev/cdrom /mnt/cdrom
cd /tmp
tar zxf /mnt/cdrom/VMwareTools-*.tar.gz
./vmware-tools-distrib/vmware-install.pl --default
@n0ts
n0ts / disable_service_centos5.sh
Last active January 4, 2016 10:59
Disable Service for CentOS 5 on VM
while read SERVICE
do
service $SERVICE stop
chkconfig $SERVICE off
done << EOL
acpid
auditd
autofs
bluetooth
firstboot