Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# Marcus Furlong <[email protected]> 4/4/2012
# Pin vcpus on xen
import sys
sys.path.insert(1, '/usr/lib/xen-4.0/lib/python')
sys.path.insert(1, '/usr/lib/xen-4.0/lib/python/xen/xm')
import os
# PACKER_LOG=1 packer build -only=vmware-iso template-vnpf.json
2016/12/01 12:36:37 [INFO] Packer version: 0.12.0
2016/12/01 12:36:37 Packer Target OS/Arch: linux amd64
2016/12/01 12:36:37 Built with Go Version: go1.7.3
2016/12/01 12:36:37 Detected home directory from env var: /root
2016/12/01 12:36:37 Using internal plugin for parallels-pvm
2016/12/01 12:36:37 Using internal plugin for digitalocean
2016/12/01 12:36:37 Using internal plugin for qemu
2016/12/01 12:36:37 Using internal plugin for virtualbox-ovf
2016/12/01 12:36:37 Using internal plugin for amazon-ebs
@weldpua2008
weldpua2008 / packer.json
Last active January 31, 2017 09:03
Packer template of ubuntu 14.04 with working ESXi
{
"provisioners": [
{
"type": "shell",
"execute_command": "echo {{user `ssh_pass`}}|sudo -S sh '{{.Path}}'",
"environment_vars": [
"ssh_name={{user `ssh_name`}}",
"ssh_pass={{user `ssh_pass`}}"
],
"override": {
@weldpua2008
weldpua2008 / gist:5407f57f2cc7e83d46ce4e0a860e5477
Created December 4, 2016 10:57
template-vnpf.json-output.txt
2016/12/04 10:45:03 packer: 2016/12/04 10:45:03 starting remote command: echo radware|sudo -S sh '/tmp/script_6106.sh'
2016/12/04 10:45:03 ui: vmware-iso: Reading package lists...
vmware-iso: Reading package lists...
2016/12/04 10:45:04 ui: vmware-iso: Building dependency tree...
vmware-iso: Building dependency tree...
2016/12/04 10:45:04 ui: vmware-iso: Reading state information...
vmware-iso: Reading state information...
2016/12/04 10:45:04 ui: vmware-iso: The following extra packages will be installed:
vmware-iso: The following extra packages will be installed:
2016/12/04 10:45:04 ui: vmware-iso: libdumbnet1 libicu52 zerofree
@weldpua2008
weldpua2008 / How can I get the architecture of a binary file.txt
Created January 15, 2017 07:20
How can I get the architecture of a binary file?
How can I get the architecture of a binary file?
readelf -h <archive>.a | grep 'Class\|File\|Machine'
[00:32:15] /usr/lib $ readelf -h libxslt.a | grep 'Class\|File\|Machine'
File: libxslt.a(attrvt.o)
Class: ELF32
Machine: Intel 80386
File: libxslt.a(xslt.o)
Class: ELF32
Machine: Intel 80386
@weldpua2008
weldpua2008 / How to build gcc.txt
Last active January 15, 2017 14:37
How to build toolchain(gcc 4.1.x & 4.9.x)
# http://stackoverflow.com/questions/27028240/gnu-configure-options-for-binutils-gcc-glib
# https://gcc.gnu.org/wiki/InstallingGCC
# https://gcc.gnu.org/ml/gcc-help/2008-02/msg00356.html
# Rebuild GCC 4.9.3
# Get all deb files:
apt-get --download-only --reinstall -o Dir::Cache="/root/4.9" -o Dir::Cache::archives="./" install gcc-4.9-multilib
#
mkdir /root/toolchain_src/ && cd /root/toolchain_src/
@weldpua2008
weldpua2008 / How to build utils for toolchain.txt
Last active January 15, 2017 08:18
How to build utils for toolchain (binutils, cmake)
#binutils 2.22
dpkg-source -x binutils_2.22-6ubuntu1.3.dsc
cd binutils-2.22/
./configure --prefix=/opt/tools/dev-tools-4.9 \
--exec-prefix=/opt/tools/dev-tools-4.9 \
--with-sysroot=/ --enable-multilib \
--with-lib-path=/opt/tools/dev-tools-4.9/lib \
--disable-werror --enable-shared \
--enable-targets=x86_64-linux-gnu,i686-linux-gnu,x86_64-pc-mingw32,i686-pc-mingw32
@weldpua2008
weldpua2008 / How to grant all psgress tables in RDS
Created January 15, 2017 08:22
How to grant all psgress tables in RDS to portal
psql_host=.us-east-1.rds.amazonaws.com
for i in `echo '\d' | psql -h ${psql_host} -U postgres -d informationmodel |grep public|awk '{print $3}'`; do psql -h ${psql_host} -U postgres -d informationmodel -c "grant all on table $i to portal;"; done
@weldpua2008
weldpua2008 / How to build libudev.txt
Created January 15, 2017 08:34
How to build libudev from Ubuntu 12.04 for gcc 4.7.x
#!/bin/bash
set -x
# build prefix
export BUILD_PATH="/opt/tools/dev-tools-4.7"
# the directory of the script
DIR="/tmp"
# the temp directory used, within $DIR
WORK_DIR=`mktemp -d -p "$DIR"`
@weldpua2008
weldpua2008 / How to manage users.txt
Created January 15, 2017 08:38
How to manage users
# SSH
# Disable root login in SSH
sed -i "s/^PermitRootLogin.*/PermitRootLogin no/g" /etc/ssh/sshd_config
# Disable
sed -i "s/^PasswordAuthentication.*/PasswordAuthentication no/g" /etc/ssh/sshd_config
# How to disable user password
sed -i "s/^user1.*/user1::16887::::::/g" /etc/shadow