Skip to content

Instantly share code, notes, and snippets.

View track0x1's full-sized avatar

Tom B track0x1

View GitHub Profile
@svet-b
svet-b / ext4_mac_docker.md
Created May 10, 2021 19:33
Mount and edit SD card image with ext4 partitions on Mac using Docker

Go to the directory with the image you want to work with. Run a Docker container with that directory mounted:

docker run -it --privileged -v /dev:/dev -v (pwd):/tmp --workdir /tmp ubuntu bash

(replace (pwd) with "$PWD" if using bash instead of fish)

See this thread for an explanation of why --privileged and -v /dev:/dev are required. The need for the latter can be avoided with this alrternative workaround.

In the container, assuming that $IMAGE_FILE is the name of your image file:

@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active March 23, 2024 09:04
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

@unbug
unbug / Middleware.js
Last active January 6, 2024 04:17
Powerful Javascript Middleware Pattern Implementation, apply middleweares to any object. https://unbug.github.io/js-middleware/
'use strict';
/* eslint-disable consistent-this */
let middlewareManagerHash = [];
/**
* Composes single-argument functions from right to left. The rightmost
* function can take multiple arguments as it provides the signature for
* the resulting composite function.
*
@vcastellm
vcastellm / ecs-run
Last active April 15, 2024 17:55
Run task and wait for result in AWS ECS
#!/usr/bin/env bash
set -e
function usage() {
set -e
cat <<EOM
##### ecs-run #####
Simple script for running tasks on Amazon Elastic Container Service
One of the following is required:
Required arguments:
@mopemope
mopemope / config.fish
Last active June 23, 2022 11:37
config.fish
# Path to Oh My Fish install.
set -gx OMF_PATH /home/ma2/.local/share/omf
# Customize Oh My Fish configuration path.
#set -gx OMF_CONFIG /home/ma2/.config/omf
set fish_plugins pbcopy
set fish_greeting ""
set -x LC_CTYPE ja_JP.UTF-8
@darrenscerri
darrenscerri / Middleware.js
Last active July 11, 2023 02:59
A very minimal Javascript (ES5 & ES6) Middleware Pattern Implementation
var Middleware = function() {};
Middleware.prototype.use = function(fn) {
var self = this;
this.go = (function(stack) {
return function(next) {
stack.call(self, function() {
fn.call(self, next.bind(self));
});
@jsdf
jsdf / ReactNativeHTML.js
Last active September 9, 2021 22:11
Rendering HTML rich text as React Native <Text> elements
var React = require('react-native')
var {
View,
Text,
LinkingIOS,
StyleSheet,
} = React
// you might want to compile these two as standalone umd bundles
// using `browserify --standalone` and `derequire`
@CrocoDillon
CrocoDillon / cookies.js
Last active February 11, 2024 22:42
Export your awesome module using AMD, CommonJS, Node.js or just as global.
/*
* Inspiration (well… copy pasting more or less) from:
* https://github.com/ScottHamper/Cookies/blob/0.3.1/src/cookies.js#L127-L140
*
* Thanks Scott!
*/
(function (global) {
'use strict';
var MyModule = function () {