Skip to content

Instantly share code, notes, and snippets.

View obengwilliam's full-sized avatar
🎯
Focusing

Obeng William obengwilliam

🎯
Focusing
View GitHub Profile
@obengwilliam
obengwilliam / gist:4e16b09b0a3843052dc8e4ae11411f7f
Last active March 8, 2023 11:56
Useful kubernetes commands
  • Delete all Evicted pods

kubectl get pods --show-all=true | grep 'Evicted' |awk '{print $1}' | xargs kubectl delete pod

@obengwilliam
obengwilliam / mbg.py
Last active May 6, 2021 20:09
mbg.py
self.init_plot(self.FEATURES)
has_converged = False
iter = 1
while not has_converged:
print(f"iter {iter}")
minibatch = random.sample(range(0, self.DATAPOINTS), self.MINIBATCH_SIZE)
for k in range(self.FEATURES):
@obengwilliam
obengwilliam / pyenv.md
Created February 16, 2021 16:10
pyenv
@obengwilliam
obengwilliam / Isomap
Created November 16, 2020 10:54 — forked from Mashimo/ Isomap
Data dimensionality reduction via isomap
Isomap is a nonlinear dimensionality reduction method.
The algorithm provides a simple method for estimating the intrinsic geometry of a data manifold based on a rough estimate
of each data point’s neighbours
@obengwilliam
obengwilliam / vim.md
Last active August 7, 2020 12:02
Vim #vim

Move tabs

in command mode type tabm [index from 0 to n represent tabs from your left to right]

Windows

Swap Ctrl + W + R

@obengwilliam
obengwilliam / antd_sc_example.js
Created May 5, 2020 08:17 — forked from newswim/antd_sc_example.js
Wrapping Ant Design components with Styled Components
import { Link } from 'react-router-dom'
import { Badge, Col, Menu } from 'antd'
const StyledBadge = styled(Badge)`
.ant-badge-count {
background-color: #7ECBBF;
color: white;
box-shadow: 0 0 0 1px #d9d9d9 inset;
}
`
@obengwilliam
obengwilliam / mongoose connection
Created April 26, 2020 14:35
quickly connect to mongodb using mongoose #mongoose #mongodb
'use strict';
const mongoose = require('mongoose');
run().catch(err => console.log(err));
async function run() {
mongoose.set('useUnifiedTopology', true);
mongoose.set('useNewUrlParser', true);
@obengwilliam
obengwilliam / bundle.js
Created April 19, 2020 17:12 — forked from jackgill/bundle.js
A node.js script to create a bundle containing an npm package, and all of its dependencies.
/*
* This script will download a package (and all of its dependencies) from the
* online NPM registry, then create a gzip'd tarball containing that package
* and all of its dependencies. This archive can then be copied to a machine
* without internet access and installed using npm.
*
* The idea is pretty simple:
* - npm install [package]
* - rewrite [package]/package.json to copy dependencies to bundleDependencies
* - npm pack [package]
@obengwilliam
obengwilliam / README.md
Last active April 15, 2020 14:33 — forked from rantav/README.md
Find slow queries in mongo DB #mongodb #performance

A few show tricks to find slow queries in mongodb

Enable profiling

First, you have to enable profiling

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...

@obengwilliam
obengwilliam / README-badges.md
Created April 9, 2020 03:55 — forked from tterb/README-badges.md
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release