Skip to content

Instantly share code, notes, and snippets.

View hendrysadrak's full-sized avatar

Hendry Sadrak hendrysadrak

View GitHub Profile
@DewaldDeJager
DewaldDeJager / README.md
Last active October 31, 2024 12:16
Easy GitHub workflow for keeping a fork in sync with upstream

Sync Fork

This workflow uses the GitHub CLI to keep a forked repo in sync with the upstream repo. Add it to your repo as .github/workflows/sync-fork.yaml.

It runs daily to sync the default branch and can be triggered manually for any branch.

@jamesdiacono
jamesdiacono / masm_to_nasm.sh
Last active October 16, 2024 15:37
The DEC64 number type for Linux (x64 and ARM), MacOS (Intel and Silicon) and Android. Include these files alongside https://github.com/douglascrockford/DEC64.
#!/bin/sh
# Translates DEC64's Windows-compatible MASM on stdin to
# UNIX-compatible NASM on stdout. Not general purpose.
# 0. Use the UNIX calling convention.
# 1. Replace equ with %define.
# 2. Replace public with global.
# 3. Replace unary macro with %macro.
# 4. Replace nullary macro with %macro.
@pesterhazy
pesterhazy / building-sync-systems.md
Last active November 17, 2024 14:32
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) {
items.push(elements[i]);
}
}
@i-like-robots
i-like-robots / fetch.js
Created March 17, 2019 11:47
Signed AWS requests with node fetch
const nodeFetch = require('node-fetch');
const httpsAgent = require('./httpsAgent');
const handleResponse = require('./handleResponse');
module.exports = async (url, options = {}) => {
const response = await nodeFetch(url, {
...options,
agent: httpsAgent
});
@atoa
atoa / delete-empty-cw-log-groups.sh
Created November 15, 2017 14:20
delete empty cloudwatch log groups
#!/usr/bin/env sh
# AWS cli delete empty cloudwatch log groups
aws logs describe-log-groups \
--query 'logGroups[?storedBytes == `0`].logGroupName' --output text | \
xargs -r -n1 aws logs delete-log-group --log-group-name
@aw
aw / mongodb-invariant-failure.md
Created March 30, 2017 06:42
[SOLUTION] MongoDB aborting after invariant() failure

I recently ran into an issue of MongoDB shell commands not working. The error message was:

Invariant failure !driverName.empty() && !driverVersion.empty() && !osType.empty() && !osName.empty() && !osArchitecture.empty() && !osVersion.empty() src/mongo/rpc/metadata/client_metadata.cpp

I ran an strace on the mongo command and saw it was trying (and failing) to open the following files:

@PaulKinlan
PaulKinlan / monitorEvents.js
Created October 14, 2016 07:38
monitorEvents.js
function monitorEvents(element) {
var log = function(e) { console.log(e);};
var events = [];
for(var i in element) {
if(i.startsWith("on")) events.push(i.substr(2));
}
events.forEach(function(eventName) {
element.addEventListener(eventName, log);
});
@subfuzion
subfuzion / curl.md
Last active November 17, 2024 03:54
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@amir-rahnama
amir-rahnama / README.md
Last active June 5, 2019 14:07
A simple Webpack (with Dev Server) + Gulp Configuration + LiveReload + Babel to playground where you can code ES6 without the need for React

A simple Webpack + Gulpfile configuration wihtout any need for React.js that assumes you have the following project structure:

node_modules/ bower_components/ scripts/

Entry script is in scripts/entry.js

You should run gulp && gulp build-dev and you are good to go.