Skip to content

Instantly share code, notes, and snippets.

@guiliredu
guiliredu / 0_NestJS-Cheatsheet.md
Last active May 6, 2024 04:54
Nest.js Cheatsheet

Nest.js Cheatsheet

Nest CLI

  • npm i -g @nestjs/cli

Packages

  • yarn add class-validator class-transformer
  • yarn add @nestjs/mapped-types
@treshugart
treshugart / example.jsx
Last active May 6, 2024 04:53
Give yourself full control over the DOM that any hyperscript VDOM style function creates http://www.webpackbin.com/4kR0ZnXFf
import hify from './create-element';
import React from 'react';
import { render } from 'react-dom';
const h = hify(React.createElement.bind(React));
class Test extends HTMLElement {
static observedAttributes = ['attr']
attributeChangedCallback (name, oldValue, newValue) {
this.innerHTML = `Hello, ${this.getAttribute('attr')}!`;
@zhujunsan
zhujunsan / Using Github Deploy Key.md
Last active May 6, 2024 04:53
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key
const tribes = require("ssb-tribes")
const Bot = require("scuttle-testbot")
const Stack = Bot.use(require("ssb-backlinks")).use(tribes)
const bot = Stack()
const Stack2 = Bot.use(require("ssb-backlinks")).use(tribes)
const bot2 = Stack2()
bot.tribes.create({}, (err, data) => {
@chaeplin
chaeplin / lgac.MD
Last active May 6, 2024 04:52
LG AC

=== decoding for LG A/C ====

=== *** ===

@DaveMDS
DaveMDS / get-docker.sh
Last active May 6, 2024 04:49 — forked from ta264/get-docker.sh
Install docker on arm64 synology
#!/bin/bash
set -e
ARCH=aarch64
DOCKER_VERSION=20.10.9
COMPOSE_VERSION=2.5.1
DOCKER_DIR=/volume1/@docker
echo "Downloading docker $DOCKER_VERSION-$ARCH"
curl "https://download.docker.com/linux/static/stable/$ARCH/docker-$DOCKER_VERSION.tgz" | tar -xz -C /usr/local/bin --strip-components=1
@vitorgalvao
vitorgalvao / Get Title and URL.applescript
Last active May 6, 2024 04:49
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Webkit variants include "Safari", "Webkit", "Orion".
-- Specific editions are valid, including "Safari Technology Preview".
-- "Safari" Example:
tell application "Safari" to return name of front document
@yunazuno
yunazuno / dns64.py
Created September 2, 2015 05:29
A DNS64 resolver with AAAA filter-like behavior (similar to the Internet Shareing on OSX El Capitan)
#!/usr/bin/env python2
from twisted.internet import reactor
from twisted.names import client, dns, server
import ipaddr
import socket
class SixFourResolver(client.Resolver):
def __init__(
self,
@diamondo25
diamondo25 / script.idc
Created July 30, 2015 12:02
MapleStory IDC script
// IDC script for identifying functions and such
#include <idc.idc>
#define RenameFunction(a, b) Message("Found %s at %a\r\n", b, a); MakeName(a, b)
#define START_ADDR 0x00400000
static main() {
auto addr = BADADDR;
auto onMovePacket = FindAoBAndRename("25 0C FE FF FF 05 E8 03", "?OnMovePacket@CMovePath@@QAEXAAVCInPacket@@H@Z");
@lgnrvz
lgnrvz / AppModule.kt
Created September 2, 2023 06:52
A ViewModel for getting the realtime location and last time collection of the user with Dagger-Hilt implementation
import android.content.Context
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
@InstallIn(SingletonComponent::class)