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 April 25, 2024 09:47
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 / dec64.nasm
Last active May 10, 2023 10:47
The DEC64 number type for Linux, MacOS (Intel and Silicon) and Android. Include these files alongside https://github.com/douglascrockford/DEC64.
; title dec64.nasm for x64.
; dec64.com
; 2022-09-03
; Public Domain
; No warranty expressed or implied. Use at your own risk. You have been warned.
; This file implements the elementary arithmetic operations for DEC64, a decimal
; floating point type. DEC64 uses 64 bits to represent a number. The low order
@pesterhazy
pesterhazy / building-sync-systems.md
Last active May 3, 2024 20:03
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 May 6, 2024 09:53
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.