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 / mysql.pyconf
Created December 22, 2014 02:35
Ganglia MySQL Configuration
###
###
### This module requires MySQL-python e.g. on Centos/RHEL
### * yum install MySQL-python
###
### Note:
### To setup database access:
### GRANT SUPER, PROCESS ON *.* TO your_user@localhost \
### IDENTIFIED BY "your_password";
###
@n0ts
n0ts / mysql.py.patch
Created December 22, 2014 02:23
Patch gmond/python_modules/db/mysql.py
--- ./gmond/python_modules/db/mysql.py-org 2014-10-23 10:20:38.000000000 +0900
+++ ./gmond/python_modules/db/mysql.py 2014-10-23 12:23:31.000000000 +0900
@@ -113,7 +113,7 @@
if get_innodb:
cursor = conn.cursor(MySQLdb.cursors.Cursor)
cursor.execute("SHOW /*!50000 ENGINE*/ INNODB STATUS")
- innodb_status = parse_innodb_status(cursor.fetchone()[0].split('\n'))
+ innodb_status = parse_innodb_status(cursor.fetchone()[2].split('\n'))
cursor.close()
logging.debug('innodb_status: ' + str(innodb_status))
@n0ts
n0ts / DBUtil.py.patch
Created December 22, 2014 02:22
Patch gmond/python_modules/db/DBUtil.py
--- ./gmond/python_modules/db/DBUtil.py-org 2014-10-23 10:24:40.000000000 +0900
+++ ./gmond/python_modules/db/DBUtil.py 2014-10-23 10:35:23.000000000 +0900
@@ -86,7 +86,7 @@
innodb_status['active_transactions']
for line in innodb_status_raw:
- istatus = line.split()
+ istatus = line.replace(',', '').replace(';', '').split()
isum = sumof(istatus)
@n0ts
n0ts / gist:493f0867b0541077768e
Created November 13, 2014 00:16
pgsql link error
...
ld: warning: directory not found for option '-L/usr/local/homebrew/Cellar/libpng/1.6.10/lib'
Undefined symbols for architecture x86_64:
"_lo_lseek64", referenced from:
_zif_pg_lo_seek in pgsql.o
"_lo_tell64", referenced from:
_zif_pg_lo_tell in pgsql.o
"_lo_truncate64", referenced from:
_zif_pg_lo_truncate in pgsql.o
ld: symbol(s) not found for architecture x86_64
@n0ts
n0ts / gist:3f6b95dec568c9674163
Created September 17, 2014 07:30
AWS EC2 create-tags
for i in `aws ec2 describe-security-groups | jq -r '@csv "\(.SecurityGroups[] | [.GroupId, .GroupName])"'`; do aws ec2 create-tags --resources `echo $i | cut -d ',' -f 1 | tr -d '"'` --tags Key=Name,Value=`echo $i | cut -d ',' -f 2 | tr -d '"'` ; done
@n0ts
n0ts / get_oracle_jdk_x64.sh
Last active September 16, 2023 12:07
Get latest Oracle JDK package bash shell script for linux/osx/windows
#!/bin/bash
# You must accept the Oracle JDK License Update
# https://www.oracle.com/java/technologies/javase-downloads.html
# usage: get_oracle_jdk_x64.sh <jdk_version> <platform> <ext>
# jdk_version: 14
# platform: linux or osx or windows
# ext: rpm or dmg or tar.gz or exec
jdk_version=${1:-14}
@n0ts
n0ts / gist:55c8650985cb519355c2
Last active August 29, 2015 14:02
brew install --powerline --vim-powerline ricty
...
==> fontforge -lang=py -script /private/tmp/ricty-JOuT/Ricty-3.2.3/scripts/powerline-fontpatcher [] Ricty-Bold.tt
Executable based on sources from 14:57 GMT 31-Jul-2012-D.
Library based on sources from 14:57 GMT 31-Jul-2012.
usage: powerline-fontpatcher [-h] [--no-rename] [--source-font font]
font [font ...]
powerline-fontpatcher: error: argument font: can't open '[]': [Errno 2] No such file or directory: '[]'
READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
@n0ts
n0ts / remove-old-kernel.sh
Created May 7, 2014 09:51
Remove old kernel
sudo apt-get remove --purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')
@n0ts
n0ts / remote_bash.sh
Created May 1, 2014 06:35
execute bash script from remote site
# http://stackoverflow.com/questions/5735666/execute-bash-script-from-url
bash <(curl -s http://mywebsite.com/myscript.txt)
# http://stackoverflow.com/questions/4642915/passing-parameters-to-bash-when-executing-a-script-fetched-by-curl
curl http://foo.com/script.sh | bash -s arg1 arg2
@n0ts
n0ts / user_agent.yml
Last active August 29, 2015 14:00
User Agent
iPhone 5s:
carrier: SoftBank
ua: Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53
width: 640
height: 1136
Nexus 5:
carrier: Others
ua: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.105 Mobile Safari/537.36
width: 1080
height: 1920