Skip to content

Instantly share code, notes, and snippets.

View hitsumabushi's full-sized avatar

hitsumabushi hitsumabushi

  • Tokyo, Japan
View GitHub Profile
@hitsumabushi
hitsumabushi / gist:96af3e99bb5efe2676f9
Created April 5, 2015 06:21
pyenv&virtualenv for zsh
# For zshrc setting
echo 'export PYENV_ROOT="${HOME}/.pyenv"' >> ~/.zshrc
echo 'if [ -d "${PYENV_ROOT}" ]; then' >> ~/.zshrc
echo ' export PATH=${PYENV_ROOT}/bin:$PATH' >> ~/.zshrc
echo ' eval "$(pyenv init -)"' >> ~/.zshrc
echo 'fi' >> ~/.zshrc
exec $SHELL -l
# Install pyenv & virtualenv
package main
import (
"time"
"github.com/jinzhu/gorm"
_ "github.com/mattn/go-sqlite3"
)
func main() {
@hitsumabushi
hitsumabushi / setup.sh
Last active August 29, 2015 14:22
Initial Setup Shell
# Install basic packages
sudo apt-get update
sudo apt-get install zsh vim git curl wget
# pyenv installer
sudo apt-get install libreadline-dev libbz2-dev libsqlite3-dev
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
#!/usr/bin/python
# -*- coding: utf-8 -*-.
import exceptions
import requests
import tempfile
from bs4 import BeautifulSoup
def main():
module = AnsibleModule(
@hitsumabushi
hitsumabushi / gist:8496cee5decf22f39585
Created June 24, 2015 11:52
doctestでprint文を無視する場合の例
x = 0
def f():
""" 適当にTrueが返る
>>> sys.stdout.write("magic comment:"); f() # doctest:+ELLIPSIS
magic comment:...
True
"""
for s in range(0, 2):
@hitsumabushi
hitsumabushi / basic.ps1
Last active September 4, 2015 12:25
Windows update
Param([string]$interfaceName, [string]$ip, [int]$prefixLength, [string]$gateway, [string[]]$dnsServers, [string]$serverName, [string]$ntpServer)
# Utility functions
function SetIPAddress ([string]$interfaceName, [string]$ip, [int]$prefixLength, [string]$gateway){
Get-NetAdapter $interface | New-NetIPAddress -IPAddress $ip -PrefixLength $prefixlength -DefaultGateway $gateway
}
function SetDNS ([string]$interface, [string[]]$dnsServers){
Get-NetAdapter $interface | Set-DnsClientServerAddress -ServerAddresses $dnsServers
}
function DisableIPv6 ([string]$interface) {
@hitsumabushi
hitsumabushi / example.py
Created August 10, 2015 17:32
example of parsimonious
from parsimonious.grammar import Grammar
conf = """diag read interface-id 1
enable
!
interfae vlan 1
!
interface ip hoo
interface id
interface route
@hitsumabushi
hitsumabushi / ovf.xml
Last active October 24, 2015 10:59
参考XML
<?xml version="1.0" encoding="UTF-8"?>
<Envelope vmw:buildId="build-913577" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<References>
<File ovf:href="a-disk1.vmdk" ovf:id="file1" ovf:size="68096" />
</References>
<DiskSection>
<Info>Virtual disk information</Info>
<Disk ovf:capacity="16" ovf:capacityAllocationUnits="byte * 2^20" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="0" />
<Disk ovf:capacity="36" ovf:capacityAllocationUnits="byte * 2^20" ovf:diskId="vmdisk2" ovf:format="http://www.vmware.com
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hitsumabushi
hitsumabushi / gist:7487f403ecd1b8435984
Created January 26, 2016 23:46
Japanese PDF build errors in Read The Docs : pdflatex -interaction=nonstopmode /home/docs/checkouts/readthedocs.org/user_builds/ja-sample/checkouts/latest/_build/latex/japanesedocumentsample.tex
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
restricted \write18 enabled.
entering extended mode
(/home/docs/checkouts/readthedocs.org/user_builds/ja-sample/checkouts/latest/_b
uild/latex/japanesedocumentsample.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 78 languages loaded.
(./sphinxmanual.cls
Document Class: sphinxmanual 2009/06/02 Document class (Sphinx manual)