Skip to content

Instantly share code, notes, and snippets.

View sandys's full-sized avatar

Sandeep Srinivasa sandys

View GitHub Profile
@sandys
sandys / nvidia-docker-cuda-setup.sh
Created March 3, 2018 09:18
getting nvidia-docker2 with CUDA running on Ubuntu-16.04
wget https://developer.nvidia.com/compute/cuda/9.1/Prod/local_installers/cuda-repo-ubuntu1604-9-1-local_9.1.85-1_amd64
sudo add-apt-repository ppa:graphics-drivers
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
@sandys
sandys / impil.py
Created February 27, 2018 09:27
Converting set of images into PDF using Pillow
from PIL import Image
import requests
from io import BytesIO
from io import StringIO
url1 = "https://res.cloudinary.com/prestige-gifting/image/fetch/fl_progressive,q_95,e_sharpen:50,w_480/e_saturation:05/https://www.prestigeflowers.co.uk/images/NF4016-130116.jpg"
url2 = "https://static.pexels.com/photos/39517/rose-flower-blossom-bloom-39517.jpeg"
url3 = "https://i.pinimg.com/736x/f2/01/57/f201574c8705365b2c3e182953f765f2--blue-roses-blue-flowers.jpg"
@sandys
sandys / vscode-gatsby.conf
Created January 26, 2018 05:44
visual studio setup to debug gatsbyjs
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch (Production)",
"type": "node",
"request": "launch",
@sandys
sandys / hardware_token.md
Last active May 19, 2020 14:14
Registering a hardware token

OSX - https://github.com/OpenSC/OpenSC/releases/download/0.16.0/OpenSC-0.16.0.dmg

Fedora - sudo dnf install pcsc-tools opensc ccid

ubuntu - sudo dnf install pcsc-tools opensc libccid

Find out where OpenSC has installed the pkcs11 module.

For OS X with binary installation this is typically in /Library/OpenSC/lib/. Homebrew users can use export OPENSC_LIBS=$(brew --prefix opensc)/lib

@sandys
sandys / pgbouncer_run.sh
Created February 17, 2017 10:56
how to write a supervisord compatible shell script for pgbouncer (which can restart gracefully)
#!/bin/bash
# inspired by http://veithen.github.io/2014/11/16/sigterm-propagation.html
if [ -z "$DBNAME" ]; then
echo "Environment variable DBNAME is not set!!!"
exit 1
else
sed -i 's|DBNAME|'"$DBNAME"'|' /etc/pgbouncer/pgbouncer.ini
fi
@sandys
sandys / pubkey_csr.md
Last active January 3, 2017 08:41
working with public key and CSR

##SHA256 hash of the public key openssl req -in namecheap-1549141.csr -noout -pubkey | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 ##will match openssl s_client -connect api.redcarpetup.com:443 | openssl x509 -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

##modulus to check in browser openssl req -in namecheap-1549141.csr -noout -modulus ##will match openssl s_client -connect api.redcarpetup.com:443 | openssl x509 -pubkey -noout | openssl rsa -pubin -noout -modulus

@sandys
sandys / magento.md
Last active December 19, 2016 08:25
magento requirements

The project is a reverse auction ecommerce store for clothes - with search and facebook login.

@sandys
sandys / bootable_usb_win10_from_linux.sh
Created June 11, 2016 17:09
create bootable Windows 10 USB drive from Ubuntu./Fedora
msdos partition table, fat32, boot flag.
Laptop set to UEFI only
mount iso - rsync -aP iso_path/* usb_drive/
reboot
@sandys
sandys / mailr_send.R
Last active October 10, 2018 21:08
R code to send email using Amazon SES
# first install mailR. It is a bit funky to install this because of the dependency on rJava
#First install java
### sudo add-apt-repository ppa:webupd8team/java
### sudo apt-get update
### sudo apt-get install oracle-java8-installer
#now you can install mailR. The assumption is that java is in /usr/lib/jvm/jdk1.8.0_66/. Check if a newer version has changed the directory
sudo JAVA_HOME=/usr/lib/jvm/jdk1.8.0_66/ R CMD javareconf
sudo JAVA_HOME=/usr/lib/jvm/jdk1.8.0_66/ Rscript -e 'install.packages(c("mailR"), .Library.site[1], repos="http://cran.us.r-project.org", dependencies=TRUE)'
@sandys
sandys / aws_config
Last active February 17, 2017 07:06
[default]
region = ap-southeast-1
s3 =
max_concurrent_requests = 20
max_queue_size = 10000
multipart_threshold = 64MB
multipart_chunksize = 16MB
use_accelerate_endpoint = true