Skip to content

Instantly share code, notes, and snippets.

@xbns
xbns / sw-to-install-after-arch-install.md
Last active July 23, 2020 11:39
After Arch Linux Installation #arch-linux
@xbns
xbns / README.MD
Last active May 1, 2020 20:11
#katex #maths #visual studio code extensions # markdown

Question: $45\space is\space 18%$ of what number?

$\therefore {part \over whole} = \frac{45}{x} = \frac{18}{100}$

$18\cdot x = 45\cdot100$

$\sout{18}\cdot x = 45\cdot100\swarrow$ Divide by 18 on both sides of equation

@xbns
xbns / as_code.md
Created February 24, 2020 14:03
#as_code

Diagram As Code

Plant UML

Infrastructure As Code

@xbns
xbns / disk-partitioning.md
Created November 8, 2019 10:39
#disk-partition

/root

  • A 12 - 20 GB partition for the OS,which gets mounted as /(called "root").
  • maximum of 20 GB for root partition should always be enough even if you install a ton of software.
  • Most distributions of Linux use either ext3 or ext4 as their file system nowadays, which has a built-in “self-cleaning” mechanism so you don’t have to defrag.
  • In order for this to work best, though, there should be free space for between 25-35% of the partition. (20% x 20 = 4GB) (35% x 20 = 7GB)
@xbns
xbns / jsonTocsv.py
Created September 26, 2019 09:15
#jsonTocsv #snippet
import json
import sys
from flatten_json import flatten
import pandas as pd
#check if you pass the input file
if sys.argv[1] is not None:
fileInput = sys.argv[1]
inputFile = open(fileInput) #open json file
@xbns
xbns / get_credit_score.py
Last active December 7, 2020 10:49
[credit scoring] Credit Score Script #credit-score #csv #json
import requests
from requests.auth import HTTPBasicAuth
import json
import csv
import logging
import sys
from logging.handlers import TimedRotatingFileHandler
FORMATTER = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
LOG_FILE = 'my_app.log'
@xbns
xbns / users.py
Last active April 15, 2024 10:28
#tech
"""
__author_ = "Josphat Mutuku"
__date__ ="2019-07-03"
"""
import requests
import unittest
import json
import ijson
@xbns
xbns / postman_api_test.js
Last active November 23, 2022 12:14
token auth [postman token authentication automation ]#postman
const lodash = require('lodash')
pm.test("Validate Response to be 200 OK", function () {
pm.response.to.have.status(200);
});
pm.test("Validate Response Time to be less than 200ms", function () {
pm.expect(pm.response.responseTime).to.be.below(200);
});
@xbns
xbns / verify-message.py
Last active January 10, 2024 19:29
#tech
"""
__author_ = "Josphat Mutuku"
__date__ ="2019-07-03"
"""
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
import unittest
@xbns
xbns / replace.py
Created June 6, 2019 08:27
#replace text #files
import fileinput
#Read in the file
with open('aws-whitepapers.txt','r') as file:
filedata=file.read()
#Replace the target string
filedata = filedata.replace('//','https://')
#Write the file out again