Skip to content

Instantly share code, notes, and snippets.

View karladler's full-sized avatar

Karl Adler karladler

View GitHub Profile
@karladler
karladler / snippets.ts
Created November 1, 2022 17:54
Some snippets that might be useful one day ...
/**
* Converts flat object into Html description list using key => value
* ```html
* <dl>
* <dt>{key}</dt>
* <dd>{value}</dd>
* </dl>
* ```
*
* @param obj
@karladler
karladler / interpol.sh
Created July 29, 2022 10:35
Fun with interpol / europol scam calls
# Playing around a bit with OSX speech synthis API to troll the spam caller.
# had some pretty funny results so far.
osascript -e "set Volume 4"
say -r 160 -v 'veena' "Hello "
osascript -e "set Volume 2"
say -r 190 -v 'veena' "I received a call from interpol about credential abusing."
sleep 1
say -r 210 -v 'veena' "It seems my passport has been stolen."
sleep 1
@karladler
karladler / TypeScript Helpers.ts
Last active January 11, 2022 08:38
Typescript helpers for building interfaces
/**
* Make all properties partial and then pick only some that are required:
* https://stackoverflow.com/questions/52703321/make-some-properties-optional-in-a-typescript-type
*/
export type OptionalExceptFor<T, TRequired extends keyof T> = Partial<T> & Pick<T, TRequired>
/**
* Type XOR
*/
type Diff<T, U> = T extends U ? never : T;
@karladler
karladler / instructions.md
Last active November 30, 2021 15:25
Code Commit multi User SSH for GIT
@karladler
karladler / common.sql
Last active March 13, 2023 15:42
Public Postgres Snippets
/* Count unique entries in `column_name` */
SELECT column_name, count(*) FROM "table_name" GROUP BY column_name;
/* find entries with (NOT) numeric string */
SELECT * FROM table_name WHERE NOT column_name ~ '^\d+\.?\d+$';
/* trim in place */
UPDATE table_name SET column_name = TRIM (column_name);
/* to lower case in place */
@karladler
karladler / invariantErrorCodes.js
Created May 20, 2021 13:04
node_modules/@apollo/client/invariantErrorCodes.js
// This file is meant to help with looking up the source of errors like
// "Invariant Violation: 35" and is automatically generated by the file
// @apollo/client/config/processInvariants.ts for each @apollo/client
// release. The numbers may change from release to release, so please
// consult the @apollo/client/invariantErrorCodes.js file specific to
// your @apollo/client version. This file is not meant to be imported.
{
"@apollo/client version": "3.2.2",
1: {
@karladler
karladler / uploadResolver.ts
Created April 1, 2020 17:03
graphql upload
import {
Resolver, Mutation, Arg,
} from 'type-graphql';
import { GraphQLUpload } from 'apollo-server-koa';
import { Stream } from 'stream';
import { createWriteStream } from 'fs';
interface Upload {
filename: string;
mimetype: string;
@karladler
karladler / UI-trouble-shooting.md
Last active January 8, 2020 09:29
evan.network Trouble shooting

Solve common UI problems on local development

node-sass build failed

Problem:

Error: Missing binding /Users/.../ui/ui-dapp-browser/node_modules/node-sass/vendor/darwin-x64-72/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x

Found bindings for the following environments:

JSON => CSV => JSON converter for digital Twins

{
    "description": "Metadata for forklifts, seperated by categories.",
    "imgSquare": "",
    "name": "Forklift Metadata",
    "dataSchema": {
      "identity": {
 "$id": "identity_schema",
@karladler
karladler / usefullsetup.md
Last active May 9, 2023 18:16
Use full OSX settings

Make autohidden dock appear fast:

defaults write com.apple.dock autohide-delay -float 0; killall Dock

Restore default delay for dock:

defaults delete com.apple.dock autohide-delay; killall Dock

Auto accept Outlook 365 autodiscover redirect