Skip to content

Instantly share code, notes, and snippets.

View armsp's full-sized avatar
👋

Shantam Raj armsp

👋
View GitHub Profile
@armsp
armsp / Steps.md
Last active May 6, 2019 15:49
Steps to run ARM containers on x86
  • Install qemu-arm-static
  • Pull arm32v7/debian:jessie
  • docker run -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static --rm -it arm32v7/debian:jessie --name rpi-test
  • apt-get update
  • apt-get upgrade
  • apt-get install nano
  • apt-get install binutils apt-utils
  • apt-get install build-essential build-essential in turn installs the following- binutils bzip2 cpp cpp-4.9 dpkg-dev fakeroot g++ g++-4.9 gcc gcc-4.9 ifupdown isc-dhcp-client
@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 / 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/*
class fish:
def __init__(self,name):
self.name = name
self.skeleton = "bones"
def swims(self):
print(self.name, "swims")
def eyes(self):
print(self.name, "has eyelids")
class salmon(fish):
@armsp
armsp / docker-compose.yaml
Last active September 16, 2018 19:03
Experiments with docker-compose
version: '3'
services:
client:
#image: ubuntu:18.10
# build : This directive can be used instead of image. Specifies the location of the Dockerfile that will be used to build this container
build: ./
container_name: Chat_client
volumes:
- ./:/code
@armsp
armsp / Poetry_magazines.md
Last active September 9, 2018 06:06
A list of curated magazines that accept poetry. Work in progress.

Poetry Foundation

  • Year round submissions
  • Provide handsome compensation
  • Submissions
  • Response Time : 7 months

VQR

  • Peading Period: July 1-31
  • Very handsome Compensation
  • Submissions
@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 / 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 / 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 / resume_upload.py
Created July 4, 2018 04:54
Resuming file uploads in flask
import hashlib
full_file = 'isd-inventory.csv'
part_file = 'isd-inventory.csv.part'
m = hashlib.md5()
with open(full_file, 'rb') as f:
for chunk in iter(lambda: f.read(128*m.block_size), b''):
m.update(chunk)
print(m.hexdigest())