Skip to content

Instantly share code, notes, and snippets.

@khalidx
khalidx / node-typescript-esm.md
Last active July 3, 2024 18:04
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@tomhicks
tomhicks / plink-plonk.js
Last active July 22, 2024 09:51
Listen to your web pages
@sloanlance
sloanlance / jq_tsv_conversion.md
Last active April 12, 2024 04:33
jq: JSONL → TSV conversion

jq: JSONL → TSV conversion

What is TSV?

TSV means "tab-separated values". I prefer this format over CSV ("comma-separated values") because it doesn't require as much quoting. Many programs that can use CSV formatted data can also use TSV, although they may need to be explicitly told of the different format if it's not detected automatically.

However, in any of the jq scripts below, "@tsv" can usually be replaced with "@csv" to get CSV output instead.

@marquesds
marquesds / bypass_zeep.py
Last active June 12, 2019 17:54
Bypass SSL Python Zeep
"""
Ref.: https://lucasmarques.me/bypass-ssl/
"""
from requests import Session
from zeep.transports import Transport
from zeep import Client
session = Session()
session.verify = False

Template composition with inclusion

Every template language I have seen provides some mechanism for one template to include another, thus supporting the reuse of repeated elements like headers and footers. The included templates are called partials in Mustache parlance:

<!-- home.hbs -->
<html>
<body>
  {{> header}}
  <p> HOME </p>
  {{> footer}}
@typpo
typpo / obfuscated.c
Last active August 29, 2015 14:00
obfuscated
#define _ 0xBEE7
#define print(str)'='//;printf\("You guessed: %s\n", str\);
#include <stdio.h>
#define f(X) int
union fi {f(fi) x; char y;}i;int main() {f(10) ff=10;for (i.x=0; (long)i.x < 1+
4*19*643-_+ff;){if(!i.x++ & _< ff)z:if (putchar(ff) && _)return ff;}print([x
for x in set(ff)]);printf("%d", (f(.))i.x);f(1) x;sscanf("22","%d", &x);
sprintf(&i.y, "%c", print(ff));printf("%c%c", putchar(print(4__2)),i.y);
print(__);f(fi{for(;;)}) y;putchar('Z'-x);goto z;}
@ericmagnuson
ericmagnuson / cartodb20_build.sh
Last active April 13, 2017 22:53
How to build CartoDB 2.0 on Ubuntu 12.04
###################################
## CartoDB 2.0 Install [Working] ##
## Tested on Ubuntu 12.04 ##
###################################
# Change password
passwd
adduser [username]
adduser [username] sudo
@ChimeraCoder
ChimeraCoder / gist:3152820
Created July 20, 2012 19:45
npm (node.js) equivalent of Python's pip freeze?
#Please tell me there is a better way to do this
#(And by 'a better way', I don't mean incorporating the cut within the awk script)
npm ls | grep -E "^(├|└)─" | cut -d" " -f2 | awk '{FS = "@"; print "\""$1"\"", ":", "\""$2"\""}'
@typpo
typpo / tree.md
Created April 23, 2012 22:30 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!