Skip to content

Instantly share code, notes, and snippets.

View mofax's full-sized avatar
🎯
Focusing

Alloys Mila mofax

🎯
Focusing
View GitHub Profile
@mofax
mofax / example.py
Created January 10, 2024 12:42
roads and petrol stations
import requests
# Your Google Maps API key
API_KEY = 'YOUR_API_KEY'
# The list of petrol stations you have
# Example: [{'name': 'Rubis Karen', 'latitude': -1.2921, 'longitude': 36.8219}]
petrol_stations = [...] # replace with your actual list
def get_road_name(lat, lon, api_key):
@mofax
mofax / reset.css
Created May 15, 2023 16:23
simple css reset
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
font-size: 1.4rem;
line-height: 1.5;
}
@mofax
mofax / scrape_entire_website_with_wget.sh
Created April 12, 2023 12:46 — forked from pe3/scrape_entire_website_with_wget.sh
Scrape An Entire Website with wget
this worked very nice for a single page site
```
wget \
--recursive \
--page-requisites \
--convert-links \
[website]
```
wget options
@mofax
mofax / kubernetes-ingress-example.yaml
Created September 17, 2021 04:22 — forked from alexellis/kubernetes-ingress-example.yaml
kubernetes-ingress-example.yaml
# From my webinar for Sysdig - Exploring Kubernetes 1.18
# Create A KinD or k3s cluster with no IngressController
# Run `arkade install ingress-nginx` to add IngressNginx to the cluster as your IngressController
# Save and apply all the Kubernetes YAML files below
# Forward the IngressController
# kubectl port-forward ingress-nginx-controller 8080:80
commit 5ec98e672d66bfa1e0dce315a8b85827372d3570
Author: Alloys Mila <mofax@users.noreply.github.com>
Date: Tue Jan 5 11:59:15 2021 +0300
readme: Include screenshots
commit a2710c6d4574beba10a75fa6ab00885fa0fd2dcd
Author: Alloys Mila <mofax@users.noreply.github.com>
Date: Tue Jan 5 11:54:54 2021 +0300
sudo apt install gnupg
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
sudo apt update
sudo apt-get install -y mongodb-org
@mofax
mofax / encryption.js
Created February 19, 2020 12:09 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);
@mofax
mofax / perfectelementary.bash
Created March 15, 2019 20:39 — forked from ezeeyahoo/perfectelementary.bash
HowTo Install the perfect Elementary-OS
#Download Elementary OS from here:
#https://elementary.io/
#Clean-up System
sudo apt-get purge midori-granite -y
sudo apt-get purge yelp -y
sudo apt-get purge evince -y
sudo apt-get purge gnome-orca -y
sudo apt-get autoremove -y
sudo apt-get autoclean -y
@mofax
mofax / a2dp.py
Created February 12, 2019 06:01 — forked from pylover/a2dp.py
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3.5
"""
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04 and also debian jessie, with bluez5.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
@mofax
mofax / postgres-cheatsheet.md
Created November 20, 2018 12:00 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)