Skip to content

Instantly share code, notes, and snippets.

Sri Vishnu Totakura tsrivishnu

Block or report user

Report or block tsrivishnu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tsrivishnu
tsrivishnu / usefull-web-links-germany.md
Last active Sep 28, 2017
Useful links when you live in Germany
View usefull-web-links-germany.md
@tsrivishnu
tsrivishnu / ubuntu_thinkpad_trackpoint_scrolling.md
Last active Nov 17, 2018
How to enable Middle button (plus Trackpoint) scrolling on Thinkpad T440p running Ubuntu 16.04
View ubuntu_thinkpad_trackpoint_scrolling.md

Trackpoint scrolling on Thinkpad T440p running Ubuntu 16.04

I have moved to use Ubuntu for work after more than 6 years of using a Macbook. Like many others, I didn't really like moving away from Mac but few limitations, especially the poor performance of Docker on Mac convinced me to stick to Ubuntu. Honestly, Ubuntu, or any other linux operating system isn't that bad once you know the basics and figure out that there is a solution for almost all the problems.

With regards to build quality, I feel, Thinkpads are the next best to Macbooks. I have seen my colleagues use windows on them and use the trackpoint scroll.

@tsrivishnu
tsrivishnu / sed-extract-matched-strings-from-file.md
Last active Jan 13, 2017
`sed` to extract matched strings from a file
View sed-extract-matched-strings-from-file.md

NOTE: This gist wasn't given so much attention while writing. So please ignore any typos or meaningless sentences.

How to match a pattern and return only a part of the lines from a file.

One might run in a case when they need to extract some information from a log file and get that information into a CSV file.

This once happened to me to look into the logs for an email sendout worked to findout the ids of users to whom we sent the emails to for a particular day. Luckily, our email service prints out to the log, the user object and the type of the email that is sent to that user object. Each line in the log file looks like this

@tsrivishnu
tsrivishnu / click_allow.scpt
Last active Jul 16, 2018 — forked from rwest/README
Convert OS X Keychain exported entries into logins for 1Password import
View click_allow.scpt
tell application "System Events"
repeat while exists (processes where name is "SecurityAgent")
tell process "SecurityAgent"
click button "Allow" of group 1 of window 1
end tell
delay 0.2
end repeat
end tell
@tsrivishnu
tsrivishnu / gitignore_already_tracked_file.md
Last active Jun 7, 2019
Git: Ignore already checked in file
View gitignore_already_tracked_file.md

Git: How can I ignore a file that is already committed to the repo?

You have a repo and quite some developers have cloned the repo and working on it. Now you want to add a file to gitignore which is already checked-in or tracked by Git.(The file is already commited into the repo)

Below are the steps on how to ignore this file (lets say the filename is config.py):

  • Add it to .gitignore:

       $ echo "config.py" >> .gitignore
@tsrivishnu
tsrivishnu / setup_pgis_server
Last active May 31, 2016
Script to setup pgis on a new ubuntu machine. https://github.com/OpenGridMap/pgis
View setup_pgis_server
#!/bin/bash
set -e
# Install required packages
sudo apt-get update
sudo apt-get install -y git unzip \
postgresql-9.3 \
postgresql-9.3-postgis-2.1 \
postgresql-server-dev-9.3 \
@tsrivishnu
tsrivishnu / uniq_addr_imap
Last active Aug 29, 2015
Check unique "from" addresses in an IMAP mailbox.
View uniq_addr_imap
#!/usr/bin/env ruby
require 'net/imap'
class String
def string_between_markers marker1, marker2
# Code snippet from http://stackoverflow.com/a/9661504/976880
self[/#{Regexp.escape(marker1)}(.*?)#{Regexp.escape(marker2)}/m, 1]
end
end
@tsrivishnu
tsrivishnu / tags_display.php
Created Sep 15, 2012
displaying the unique tags in a XML RSS Feed using PHP
View tags_display.php
<?php
$url = $_GET['feed_url'];
ini_set( "display_errors", 0);
if(@$test = file_get_contents($url))
{
if($xml = simplexml_load_string($test))
{
$search = array('<', '>', 'red</font>&gt;');
$replace = array('&lt;<font color=red>', '</font>&gt;','red>');
You can’t perform that action at this time.