Skip to content

Instantly share code, notes, and snippets.

View mykeels's full-sized avatar
😄
faffing!

Ikechi Michael mykeels

😄
faffing!
View GitHub Profile
function changeMac() {
local mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
sudo ifconfig en0 ether $mac
sudo ifconfig en0 down
sudo ifconfig en0 up
echo "Your new physical address is $mac"
}
# Unlimited WiFi ✨
@mykeels
mykeels / bg.sh
Created May 4, 2019 08:30
An alias to run code in the background
#!/bin/bash
# usage:
# bg <code>
function bg () {
$@ >/dev/null >&/dev/null
}
@mykeels
mykeels / run.sh
Created May 3, 2019 09:39
A shell script to repeat a command, a specified number of times
# function run
run() {
number=$1
shift
for i in `seq $number`; do
$@
done
}
# usage:
# run <number> <script>
@mykeels
mykeels / .gitconfig
Created May 3, 2019 09:36
My .gitconfig file
[user]
# be sure to replace this
email = example@mailinator.com
name = Ikechi Michael
[alias]
squash = !git reset $(git merge-base develop $(git rev-parse --abbrev-ref HEAD))
current-branch = !git rev-parse --abbrev-ref HEAD
publish = !git push --set-upstream origin $(git current-branch)
ignore = !curl https://raw.githubusercontent.com/github/gitignore/master/Node.gitignore -O && mv Node.gitignore .gitignore
license-mit = !curl https://raw.githubusercontent.com/angular/angular.js/master/LICENSE -O

Compiling with optimisations

gcc -O3 -funroll-loops pascal.c && time ./a.out

@mykeels
mykeels / Random-Twitter-Bot.md
Last active November 29, 2021 23:27
A twitter bot that picks users at random, useful for giveaways.

An idea for a twitter bot

  • that picks users at random

I got this idea when I saw unicodeveloper's tweets about picking five twitter accounts, that indicate interest in an advanced JavaScript course, at random to gift the course to.

Syntax

Here's a list of correct syntax for such a bot, and meanings:

@mykeels
mykeels / ListNetworks.ino
Created February 26, 2019 13:18
Arduino -> ESP8266 Wifi Module program to list available WiFi networks
// See https://github.com/bportaluri/WiFiEsp
// See blog post https://medium.com/@mykeels/connect-to-wifi-with-arduino-9eee4b02d904
#include <WiFiEsp.h>
#ifndef HAVE_HWSERIAL1
#include <SoftwareSerial.h>
SoftwareSerial wSerial(6, 7);
#endif
void setup() {
@mykeels
mykeels / count-andela-jobs.js
Last active August 26, 2020 01:56
Shows an animation, when counting the jobs on Andela's job board.
/**
copy & paste into the browser console
on https://boards.greenhouse.io/andela
*/
(() => {
// create display box
if (!$('#count-popover').length) {
$('#footer').append(`<div style="position:fixed;height:200px;width:200px;left:calc(50% - 100px);top: calc(50% - 100px);border:2px solid black;background-color: white;font-size: 50px;text-align: center;line-height: 200px;" id="count-popover">0</div>`)
}
@mykeels
mykeels / A-JS-Fork-Bomb.md
Created November 29, 2018 07:53
Write a Fork Bomb in Browser JavaScript that keeps opening browser windows.

Write a Fork Bomb in Browser JavaScript that keeps opening browser windows.

@mykeels
mykeels / slack-day
Last active November 13, 2018 13:12
A shell script to change slack's colors
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
INTEROP_FOLDER="/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static"
BACKUP_FILE="$DIR/backup/ssb-interop.js"
if [ -f "$BACKUP_FILE" ]
then
cp "$BACKUP_FILE" "$INTEROP_FOLDER"