Skip to content

Instantly share code, notes, and snippets.

Timi Aiyemo cozzbie

Block or report user

Report or block cozzbie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View raspbian_setup.file
# recovery.cmdline
silentinstall
# /os/Raspbian/partition_setup.sh
# Enable SSH
echo 'ssh' >/tmp/1/ssh
# Configure WiFi
echo 'ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev' >> /tmp/1/wpa_supplicant.conf
View selecttxt.js
const selection = window.getSelection();
const range = document.createRange();
const element = document.getElementById('elmt');
// Collect a range based off the contents of an element.
range.selectNodeContents(element);
// Clear ranges that might be stored in the selection object.
selection.removeAllRanges();
selection.addRange(range);
View intToBase2.js
let convertIntToBase2 = (n, p) => {
p += n % 2;
return n <= 0 ? p.split('').reverse().join('') : convertIntToBase2(parseInt(n / 2), p);
}
@cozzbie
cozzbie / bash.cheat
Created Jul 6, 2018 — forked from afair/bash.cheat
Bash Scripting Quick Reference
View bash.cheat
==========================================
BASH SCRIPTING ==========================================
========================================== TEST COMMAND
==========================================
Invoke: bash [options] file
Shebang: #!/usr/bin/env bash Test: test expression
In script: [ expression ]
========================================== Alternate: [[ espression ]]
LOOP Does not split string words
========================================== Does not expand pathglobs*
@cozzbie
cozzbie / docker-cleanup-resources.md
Created Jul 2, 2018 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
View Dockerfile
FROM docker.io/node:8-stretch
LABEL net.skyplabs.maintainer-name="Paul-Emmanuel Raoul"
LABEL net.skyplabs.maintainer-email="skyper@skyplabs.net"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends chromium
View bitwise-add-subtract.js
function add(a, b) {
if(b == 0) return a;
return add(a ^ b, (a & b) << 1);
}
add(4, 5) // 9
function subtract(a, b) {
return (add(a, add(~b, 1)));
}
View pwa.js
// Flag for enabling cache in production
var doCache = false;
var CACHE_NAME = 'pwa-app-cache';
// Delete old caches
self.addEventListener('activate', event => {
const currentCachelist = [CACHE_NAME];
event.waitUntil(
caches.keys()
View webrtcaliceremote.js
alice.setRemoteDescription(new RTCSessionDescription(data)) // 'data' is the session sent from Bob.
You can’t perform that action at this time.