Skip to content

Instantly share code, notes, and snippets.

@mokoshalb
mokoshalb / Office_kms
Created July 4, 2019 05:36 — forked from CHEF-KOCH/KMS_office.cmd
KMS server Windows
cd\Program Files\Microsoft Office\Office16
cd\Program Files (x86)\Microsoft Office\Office16
cscript OSPP.VBS /sethst:kms.digiboy.ir
cscript OSPP.VBS /actcscript OSPP.VBS /dstatus
slmgr.vbs /ckms

JavaScript Interview Questions

Q1: Explain equality in JavaScript ☆

Answer: JavaScript has both strict and type–converting comparisons:

  • Strict comparison (e.g., ===) checks for value equality without allowing coercion
  • Abstract comparison (e.g. ==) checks for value equality with coercion allowed
@danbst
danbst / example.nix
Created April 8, 2017 07:07
Extending NixOS submodules
# this example adds an option `.tomcatProxy` in namespace
# services.nginx.virtualHosts.*.locations.*
# that acts as alternative to specifying actual nginx config in .extraConfig
#
# execute with
/*
cat $(grep -o "/nix/store/[a-z0-9]*-nginx.conf" \
$(NIX_PATH=nixos-config=./example.nix:$NIX_PATH \
nix-build --no-out-link -E '
with import <nixpkgs/nixos> {};

Interview Questions

Node.js

Q1: What do you mean by Asynchronous API? ☆☆

Answer: All APIs of Node.js library are aynchronous that is non-blocking. It essentially means a Node.js based server never waits for a API to return data. Server moves to next API after calling it and a notification mechanism of Events of Node.js helps server to get response from the previous API call.

Source: tutorialspoint.com

@mjbalcueva
mjbalcueva / calendar.tsx
Last active May 10, 2024 20:02
shadcn ui calendar custom year and month dropdown
"use client"
import * as React from "react"
import { buttonVariants } from "@/components/ui/button"
import { ScrollArea } from "@/components/ui/scroll-area"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { cn } from "@/lib/utils"
import { ChevronLeft, ChevronRight } from "lucide-react"
import { DayPicker, DropdownProps } from "react-day-picker"
@dimo414
dimo414 / heartbeat.sh
Last active May 10, 2024 20:01
Basic Server Heartbeat Script
#!/bin/bash
# Source: https://gist.github.com/dimo414/10d6f162fb6d72f517a041d28d92314f
#
# This is a basic heartbeat monitoring script suitible for adding to
# a machine's crontab to receive alerts (via https://healthchecks.io)
# when the machine is unhealthy.
#
# I use it to keep an eye on my headless Raspberry Pi, but it should
# work for most Linux machines.
#
@ymulenll
ymulenll / createBook.mjs
Created April 22, 2023 03:11
lambda put item in dynamodb using nodejs
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb";
import { randomUUID } from "crypto";
const ddbDocClient = DynamoDBDocumentClient.from(new DynamoDBClient({}));
export const handler = async (event, context) => {
try {
const book = JSON.parse(event.body);
@mitchellh
mitchellh / merge_vs_rebase_vs_squash.md
Last active May 10, 2024 19:51
Merge vs. Rebase vs. Squash

I get asked pretty regularly what my opinion is on merge commits vs rebasing vs squashing. I've typed up this response so many times that I've decided to just put it in a gist so I can reference it whenever it comes up again.

I use merge, squash, rebase all situationally. I believe they all have their merits but their usage depends on the context. I think anyone who says any particular strategy is the right answer 100% of the time is wrong, but I think there is considerable acceptable leeway in when you use each. What follows is my personal and professional opinion: