Skip to content

Instantly share code, notes, and snippets.

View armsp's full-sized avatar
👋

Shantam Raj armsp

👋
View GitHub Profile
@armsp
armsp / Dockerfile
Last active August 25, 2018 10:03
Dockerfile to install python, pandas, sklearn, numpy, scipy on a ubuntu 18.10 container (works under restricted ssl certificate environments too)
FROM ubuntu:18.10
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends apt-utils software-properties-common wget \
&& apt-get install -y build-essential python3 python3-distutils \
&& wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py \
&& python3 get-pip.py --trusted-host pypi.org --trusted-host files.pythonhosted.org
#RUN apt-get install python3.6 python-pip
#RUN python -m pip install pip --upgrade
#RUN python -m pip install wheel
#RUN apt-get install -y python3-numpy
@armsp
armsp / HTTP status codes.md
Created August 26, 2018 09:57
Proper way to return HTTP status codes with custom messages when a restful API on Flask server fails while processing inputs.

HTTP Error Codes

  • 1xx : Informational
  • 2xx : Success
  • 3xx : Redirection
  • 4xx : Client Error
  • 5xx : Server Error

HTTP Status Codes from MDN

200 OK

@armsp
armsp / punch.py
Created August 29, 2018 16:04 — forked from koenbollen/punch.py
Proof of Concept: UDP Hole Punching
#!/usr/bin/env python
#
# Proof of Concept: UDP Hole Punching
# Two client connect to a server and get redirected to each other.
#
# This is the client.
#
# Koen Bollen <meneer koenbollen nl>
# 2010 GPL
#
@armsp
armsp / 30-randomize-mac-address.conf
Created December 9, 2018 04:24 — forked from fawkesley/30-randomize-mac-address.conf
MAC address randomization in Ubuntu 17+ (>= 1.4.1): save to /etc/NetworkManager/conf.d/
# /etc/NetworkManager/conf.d/30-randomize-mac-address.conf
# REQUIRES NETWORK MANAGER >= 1.4.1 (Ubuntu Zesty and above)
# Thanks to https://blogs.gnome.org/thaller/2016/08/26/mac-address-spoofing-in-networkmanager-1-4-0/
# This randomize your MAC address for *new* connections
# Be sure to change your existing (saved) connections in
# /etc/NetworkManager/system-connections/*
@armsp
armsp / Dockerfile
Created December 12, 2018 04:18
Gist containing simple Dockerfile and steps to run GUI from a docker container
#FROM python:3.7 ## Works with either of the base images. Size is larger with Python due to there being python2.7 too
FROM ubuntu:18.10
RUN apt-get update && apt-get upgrade -y
RUN apt-get install python3-dev python3-pip -y
RUN apt-get install python3-gi -y && \
apt-get install gir1.2-gtk-3.0 -y && \
apt-get install gir1.2-appindicator3-0.1 -y
@armsp
armsp / highqualitygif.md
Last active January 14, 2019 10:17
How to create high quality gifs for Github READMEs

Steps:

  • Record a asciicast file

    • Use termtosvg record <outputfilename.cast> to record a asciicast file
    • Alternatively use asciinema rec to do the same i.e get an asciicast file
  • Then use asciicast2gif <asciicastfilename.cast> <outputfilename.gif> to convert asciicast to high quality gif

@armsp
armsp / query.md
Last active February 8, 2020 11:46
GraphQL query to get user statistics like total followers, stargazers, watchers, issues, pull requests
query {
  user(login:"<any user name>"){               #Use "viewer" if you want to run it on your profile
    repositories(orderBy: {field: STARGAZERS, direction: DESC}){
      totalCount
    }
    followers{
      totalCount
    }
 issues_sum:issues{
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@armsp
armsp / username@hostname.py
Created November 11, 2019 17:50
Generate cool <username>@<hostname> like Docker does using Python
import random
left = ["admiring",
"adoring",
"affectionate",
"agitated",
"amazing",
"angry",
"awesome",
"beautiful",
@armsp
armsp / fontawesome-github.svg
Last active March 5, 2020 17:22
Gist for seeing the difference in Chrome and Firefox renderings for a two.js project
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.