Skip to content

Instantly share code, notes, and snippets.

View mekwall's full-sized avatar
Coffee. Coffee. Coffee.

Marcus Ekwall mekwall

Coffee. Coffee. Coffee.
View GitHub Profile
@mekwall
mekwall / index.ts
Last active November 23, 2022 12:39
Rename js files with @flow header to ts/tsx
import { Stats } from "fs";
import { readdir, lstat, readFile, rename } from "fs/promises";
import path from "path";
import { transformAsync } from "@babel/core";
const isDry = !!process.argv.find((a) => a.includes("--dry"));
const jsExtRegex = /\.(js)$/;
async function* walkPath(
basePath: string
@mekwall
mekwall / upload-testflight.yml
Created November 10, 2020 11:51
GitHub Action: Build and upload IPA to TestFlight
name: Build and upload IPA to TestFlight
on:
push:
tags:
- testflight
env:
EXPO_APPLE_ID: ${{ secrets.EXPO_APPLE_ID }}
EXPO_APPLE_PASSWORD: ${{ secrets.EXPO_APPLE_PASSWORD }}
jobs:
publish:
@mekwall
mekwall / parseArgs.js
Created August 7, 2020 21:36
A dead simple NodeJS argument parser
/*
parseArgs works for the following:
-f bar
--foo bar
-f=bar
--f=bar
*/
const parseArgs = () => {
const args = {};
const rxp = /-{1,2}(?<flag>[\w\n]+)[= ]{1}(?<value>[^\s]+)/gi;
import React from "react";
import { useStores } from "@app/stores";
import { TodoItem } from "@app/components";
export const TodoList = () => {
const { todoStore } = useStores();
// This call will trigger a fetch automatically if we don't have any data
const containers = todoStore.getAll();
@mekwall
mekwall / yay.js
Created August 20, 2015 09:55
Ehrmagherd
// Start polling it for online check and game installed properly (ie the API is setup correctly)
// Origin needs some time starting + settings up the actual API correctly...
var pollCheckIfSignedIn = function() {
originlaunch.isOriginRunning(function(isRunning) {
if(isRunning) {
originlaunch.isOriginLoggedIn(function(isLoggedIn) {
if(isLoggedIn) {
function pollCheckIfGameIsInstalled() {
originlaunch.isGameInstalled(S.globalContext.realm.game,
function (isInstalled) {
@mekwall
mekwall / convert.bat
Created December 10, 2014 11:53
A small batch script to convert video to web formats with ffmpeg (supports dropping)
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
echo video convert to web
echo **************************
echo.
if not "%1"=="" set input=%1
if "%1"=="" set /p input= Input File :
set /p output= Output filename :
@mekwall
mekwall / keybase.md
Last active February 12, 2022 08:42

Keybase proof

I hereby claim:

  • I am mekwall on github.
  • I am mekwall (https://keybase.io/mekwall) on keybase.
  • I have a public key whose fingerprint is C449 358B 90C8 77F1 A631 B7CF 9937 3E70 E32C E969

To claim this, I am signing this object:

@mekwall
mekwall / bandwidth.js
Created January 4, 2013 22:50
How to measure bandwidth of a server in Node.js (and some other statistics)
const net = require("net");
var server = net.createServer(function (c) {
var oldWrite = c.write;
c.write = function(d) {
if (!Buffer.isBuffer(d)) {
d = new Buffer(d);
}
oldWrite.call(this, d);
server.bytesSent += d.length;