Skip to content

Instantly share code, notes, and snippets.

@innyso
innyso / jinja2_template_file.md
Last active May 16, 2020 05:31
#python #jinja #template #input #snippet

Code snippet for how to use jinja2 with file as an input for template.

from jinja2 import Environment,FileSystemLoader

env = Environment(loader=FileSystemLoader('files'))
template = env.get_template('somefilename.sh.j2')
output = template.render(name='elmo')
print output
@innyso
innyso / check_cmd_exist_in_make.md
Last active May 16, 2020 05:30
#makefile #cmd #exist #syntax #snippet

Check if a command exist in Makefile

LS := ; @which ls > /dev/null

ifndef LS
$(eval ls := $(shell which ls))
else
$(eval ls := something/ls
endif
@innyso
innyso / for_loop_in_makefile.md
Last active May 9, 2020 12:01
#makefile #forloop #syntax

how to do for loop in makefile

COFFEETYPE=flatwhite latte cappuccino 

forloop-test:
  $(foreach coffee, $(COFFEETYPE), echo $(coffee);)
@innyso
innyso / path_in_cygwin.md
Created May 23, 2016 00:45
Correct reference path in cygwin

In cygwin, when referring path from the c drive, make sure we add /cygdrive before the /c/folder1/folder2

@innyso
innyso / ansible_babun.md
Created June 15, 2016 00:28
Getting ansible working on babun

When using ansible on babun I am getting the following error

 [main] python2.7 16500 child_info_fork::abort: address space needed by '_speedups.dll' (0x4B0000) is already occupied

The error was due to the the _speedups.dll provided in markupsafe python library.

Uninstall the markupsafe (I have to do it manually)

@innyso
innyso / container_arbitrary_uid.md
Created June 22, 2016 03:04
Support Arbitrary user ids

When running container in container with arbitrary user id but you want a proper uid to perform task like git pull or any runnable container task.

User nss_wrapper

in Dockerfile

yum install nss_wrapper
.....
command ["./startup.sh"]
@innyso
innyso / babun_golang_setup.md
Last active July 14, 2016 05:19
Setting up Golang on babun

When setting up golang in babun or cygwin, make sure we set the following

export GOROOT=<<root to your go installtion. e.g. "c:\tools\go">>>
export GOPATH=<<full path to working dir in qoute, cant use linux style path e.g. "c:\workspace\">>
@innyso
innyso / atreus_fireware_upload_command.md
Last active April 27, 2020 23:40
#keyboard #atreus

command for upload firmware to atreus and the most important is to remeber the usb device identifier

make upload KEYMAP=mykeymapfile USB=/dev/cu.usbmodem1421
@innyso
innyso / pip_list_upgrade.md
Last active April 12, 2020 11:17
#python #pip

list and upgrade pip modules

pip list --outdated | cut -d' ' -f1 | xargs pip install -U
@innyso
innyso / docker_cooperate_proxy.md
Last active April 12, 2020 11:16
#docker #macos #proxy

using docker for mac behind cooperate proxy

Assuming that you are behind a cooperate proxy and running cntlm or squid to proxy all your outgoing traffic to the interweb.

When using docker for Mac, becuase docker for mac provision a xhyve VM under the hood, so having set the docker preference proxy setting to http[s]://localhost:3128 is not going to help as localhost == xhyve VM not the Mac.

Logging into the xhyve VM