sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
// dynamic.controller.ts | |
export const createDynamicController = ({ customPath }): Type<any> { | |
@Controller() | |
class MyController { | |
constructor(private service: MyService) { } | |
@Get([customPath]) | |
async getSomething(@Res() res: Response) { | |
//... | |
} |
import requests | |
# Define connection details | |
server_url = 'http://192.168.0.200:8096' | |
username = 'User' | |
password = 'Password' | |
# Build json payload with auth data | |
auth_data = { | |
'username': username, |
Example Node-RED that adds a sidebar panel in the editor
git clone this gist somewhere
In ~/.node-red
run: npm install <path to where the gist is>
Restart Node-RED
Reload the editor and marvel at the new sidebar tab
import { ObjectType, Field } from "@nestjs/graphql"; | |
@ObjectType() | |
export class PageInfo { | |
@Field({ nullable: true }) | |
startCursor: string; | |
@Field({ nullable: true }) | |
endCursor: string; |
Install, build and debug a react native app in WSL2 (Windows Subsystem for Linux) and Ubuntu.
xhost + ${hostname}
to allow connections to the macOS host *export HOSTNAME=`hostname`
* environment:
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# This is how I used it: | |
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history | |
import sys | |
import time |
// http://stackoverflow.com/a/107657 | |
constexpr unsigned long long int HashStringToInt(const char *str, unsigned long long int hash = 0) | |
{ | |
return (*str == 0) ? hash : 101 * HashStringToInt(str + 1) + *str; | |
} | |
void simple_switch(const std::string &str) | |
{ | |
switch (HashStringToInt(str.c_str())) | |
{ |