Skip to content

Instantly share code, notes, and snippets.

View tridevgurung's full-sized avatar

Tridev Gurung tridevgurung

View GitHub Profile
@tridevgurung
tridevgurung / Ansible-Vault how-to.md
Created March 18, 2016 05:17 — forked from tristanfisher/Ansible-Vault how-to.md
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

##Working with ansible-vault

I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@tridevgurung
tridevgurung / collect.sh
Created February 25, 2016 06:16
Collection Script
#!/bin/bash
APPNAME="appfolder"
MOUNT_POINT="/media/hdd"
APP_PATH="$MOUNT_POINT/$APPNAME"
USERS_DIR="$APP_PATH/workers"
sudo chmod -R 777 /$APP_PATH
mv $USERS_DIR/*/tagged/* $APP_PATH/delivery
@tridevgurung
tridevgurung / dispatcher.sh
Last active February 25, 2016 06:19
Dispatching script
#!/bin/bash
APPNAME="appfolder"
FILE_EXTENSION='.gte'
MOUNT_POINT="/media/hdd"
APP_PATH="$MOUNT_POINT/$APPNAME"
TMP_DIR="/tmp/$APPNAME/fohor"
TMP_DIR_CHUNKS="/tmp/$APPNAME/fohor/chunks"
@tridevgurung
tridevgurung / smb.conf
Created February 25, 2016 05:36
Example of smb.conf
[global]
workgroup = WORKGROUP
server string =
security = user
map to guest = bad user
dns proxy = no
log file =
[The Vault]
path = /media/hdd/folder/
@tridevgurung
tridevgurung / ImageInputCount.bat
Created July 29, 2015 11:00
Batch file to count the number of files and making a text file upon it.
echo OFF
:: Delayed Expansion causing variables to exanded at execution time rather than at parse time
setlocal enabledelayedexpansion
dir /ad /b > tel2.txt
::Entering in Day Folder
for /F "tokens=*" %%j in (tel2.txt) do (
cd "%%j"
echo "%%j"
dir /ad /b > tel1.txt
::Entering in Event Folder
@tridevgurung
tridevgurung / changemask
Created January 7, 2015 06:01
Ansible yml playbook to change all the hosts present in servers to /22
- hosts:
servers
user: user
sudo: yes
port: 2020
gather_facts: false
tasks:
- name: Change subnet into /22
lineinfile: dest=/etc/network/interfaces regexp='netmask 255.255.254.0' line='netmask 255.255.252.0'
- name: Restarting networking service
@tridevgurung
tridevgurung / gist:568b84a306813d472a31
Last active August 29, 2015 14:03
ASSIGN AWS ELASTIC IP (EIP) WITH WINDOWS POWERSHELL
# User modifyable items: #################################################
# Update to the AWS SDK Path on your system, if not default
Add-Type -Path "C:\Program Files (x86)\AWS SDK for .NET\bin\AWSSDK.dll"
# Update the following lines, as needed:
$accessKeyID="your access key ID"
$secretAccessKey="your secret access key"
$instanceID="i-your instance id"
$instanceEIP="x.x.x.x"
@tridevgurung
tridevgurung / gist:6522985
Created September 11, 2013 12:36
config.php
<?php defined('MOODLE_INTERNAL') || die();
$configuration = array (
'siteidentifier' => NULL,
'stores' =>
array (
'default_application' =>
array (
'name' => 'default_application',
'plugin' => 'file',
'configuration' =>
@tridevgurung
tridevgurung / maya
Created June 27, 2013 04:11 — forked from thapakazi/maya
# असारको माया
यो माया भन्‍ने चिज कस्तो
गर्मीमा घाम नलागेको जस्तो
लोडसेडीगमा tube-lite बाल्या जस्तो॥
यतिमात्र होईन, कि कसो,
गाईको दुध पनि कस्तो सस्तो
ncell को sim-card लिए जस्तो