Skip to content

Instantly share code, notes, and snippets.

View netEmmanuel's full-sized avatar
🦅
Crushing it

Emmanuel Oyelakin netEmmanuel

🦅
Crushing it
View GitHub Profile
@netEmmanuel
netEmmanuel / setup.sh
Last active February 16, 2023 18:18
MacBook Pro setup script
echo "Creating an SSH key for you..."
ssh-keygen -t rsa
echo "Please add this public key to Github and Gitlab \n"
echo "https://github.com/account/ssh \n"
echo "https://gitlab.com/profile/keys \n"
read -p "Press [Enter] key after this..."
echo "Installing xcode-stuff"
xcode-select --install
@netEmmanuel
netEmmanuel / anomaly_detection.ipynb
Created January 9, 2021 20:33
anomaly_detection.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@netEmmanuel
netEmmanuel / Coin flip game
Created October 15, 2020 23:33
Coin Flip game between two friends: You and your friend toss a coin continuously, if the sequence HH appears first you win, if TH appears first your friend wins, who is more likely to win?
import random
def coin_toss():
friendA = 0
friendB = 0
previousFlip = 0
#continue the loop until one of the friends win
while friendA == 0 & friendB == 0:
@netEmmanuel
netEmmanuel / word_frequency.py
Created April 17, 2020 23:46 — forked from nmpowell/word_frequency.py
Count words in a text file, sort by frequency, and generate a histogram of the top N
#!/usr/bin/python
"""Python script to create a histogram of words in a text file.
Usage: python word_frequency.py -f "/path/to/file.txt" -n 200
Specify the path to the text file as above. Manually specify the top N words to report (default 100).
Text file can contain punctuation, new lines, etc., but special characters aren't handled well.
@netEmmanuel
netEmmanuel / left_rotate.java
Created August 23, 2019 09:03
Solution to left rotate problem on hackerrank
public class Solution {
// Complete the rotLeft function below.
static int[] rotLeft(int[] a, int d) {
// get the size of the current array
int size = a.lenght;
// declare a new array and make it the same size as the original array
int[] rotated_array = new int[size];
@netEmmanuel
netEmmanuel / webdev_online_resources.md
Created August 30, 2018 15:53 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
@netEmmanuel
netEmmanuel / delete_custom_post_type.php
Created November 14, 2017 14:38 — forked from jazibsawar/delete_custom_post_type.php
WordPress $wpdb: Delete all posts of a custom post type with its associated meta data (taxonomies, post meta) using SQL query & $wpdb
<?php
function delete_custom_posts($post_type = 'post'){
global $wpdb;
$result = $wpdb->query(
$wpdb->prepare("
DELETE posts,pt,pm
FROM wp_posts posts
LEFT JOIN wp_term_relationships pt ON pt.object_id = posts.ID
LEFT JOIN wp_postmeta pm ON pm.post_id = posts.ID
WHERE posts.post_type = %s