Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Working from home

Hemanth B hemanth22

😀
Working from home
View GitHub Profile
@hemanth22
hemanth22 / DisplayImage.ps1
Created Feb 20, 2021 — forked from zippy1981/DisplayImage.ps1
Display an image from Windows Powershell
View DisplayImage.ps1
# Loosely based on http://www.vistax64.com/powershell/202216-display-image-powershell.html
[void][reflection.assembly]::LoadWithPartialName("System.Windows.Forms")
$file = (get-item 'C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg')
#$file = (get-item "c:\image.jpg")
$img = [System.Drawing.Image]::Fromfile($file);
# This tip from http://stackoverflow.com/questions/3358372/windows-forms-look-different-in-powershell-and-powershell-ise-why/3359274#3359274
View crik8s.playbook
---
- hosts: localhost
become: true
gather_facts: true
tasks:
- name: Install pip on the servers
yum:
name: python-pip
state: latest
update_cache: true
@hemanth22
hemanth22 / Vagrantfile
Created Dec 19, 2020 — forked from z3cka/Vagrantfile
Sample base Vagrantfile with 2GB of ram and 2 cpus :-) Initialize with: vagrant init precise32 http://files.vagrantup.com/precise32.box
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
@hemanth22
hemanth22 / links.md
Created Dec 4, 2020 — forked from g0t4/links.md
Starting Point Files for Jenkins2 Getting Started course
View links.md
@hemanth22
hemanth22 / gzip_files_in_python.md
Created Dec 1, 2020 — forked from theJollySin/gzip_files_in_python.md
Reading & Writing GZIP Files Faster in Python
View gzip_files_in_python.md

Reading & Writing GZIP Files in Python

I have been testing various ways to read and write text files with GZIP in Python. There were a lot of uninteresting results, but there were two I thought were worth sharing.

Writing GZIP files

If you have a big list of strings to write to a file, you might be tempted to do:

f = gzip.open(out_path, 'wb')
for line in lines:
@hemanth22
hemanth22 / .gitconfig
Created Oct 19, 2020 — forked from rab/.gitconfig
A good starting point for ~/.gitconfig
View .gitconfig
# -*- Conf -*-
[color]
branch = auto
diff = auto
status = auto
showbranch = auto
ui = true
# color.branch
# A boolean to enable/disable color in the output of git-branch(1). May be set to always, false (or
@hemanth22
hemanth22 / subjenkins.md
Created Oct 11, 2020
subdirectory jenkins pipeline
View subjenkins.md

node { stage("Verification"){ dir("${env.WORKSPACE}"){ sh "pwd" } } }

View provider.tf
provider "aws" {
region = "${var.region}"
profile = "${var.profile}"
}
View outputs.tf
output "url-jenkins" {
value = "http://${aws_instance.jenkins-ci.0.public_ip}:8080"
}
output "url-gitLab" {
value = "http://${aws_instance.gitLab.0.public_ip}"
}
View variables.tf
variable "profile" {
default = "terraform_iam_user"
}
variable "region" {
default = "ap-southeast-1"
}
variable "instance" {
default = "t2.nano"