Skip to content

Instantly share code, notes, and snippets.

View GentlemanHu's full-sized avatar
🎯
Focusing

Gentleman.Hu GentlemanHu

🎯
Focusing
View GitHub Profile
@pksunkara
pksunkara / config
Last active July 21, 2024 22:19
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active June 4, 2024 04:16
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@davestewart
davestewart / broadcast-channel.md
Last active May 14, 2024 18:53
Example of using BroadcastChannel to communicate with pages in the same domain

screenshot

@fnky
fnky / ANSI.md
Last active July 22, 2024 12:03
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@JonathanLPoch
JonathanLPoch / nmap-diff.sh
Last active October 4, 2022 15:56
Lightweight Nmap Topology Scanning
#!/bin/sh
DEFAULTNMAPOPTIONS="-T4 -sV -Pn --top-ports 5000 -R"
NMAPOPTIONS="$DEFAULTNMAPOPTIONS"
die() {
printf '\033[38;5;9m%s\033[0m\n\n' "$1" >&2
display_usage
exit 1
}

Interview Questions

Kotlin

Q1: What is a primary constructor in Kotlin? ☆☆

Answer: The primary constructor is part of the class header. Unlike Java, you don't need to declare a constructor in the body of the class. Here's an example:

@aagarwal1012
aagarwal1012 / flutter-ci.yml
Last active March 23, 2024 11:54
CI for your Flutter apps on GitHub Actions.
name: Flutter CI
# This workflow is triggered on pushes to the repository.
on:
push:
branches:
- master
# on: push # Default will running for every branch.
@SeniorMars
SeniorMars / java.vim
Last active November 18, 2023 16:50
Example vimrc for java development. https://youtu.be/ssmFzoZS2G8
filetype plugin indent on
syntax on "activates syntax highlighting among other things
set autoindent "indent base on previous and syntax
set backspace=indent,eol,start "Fixes the backspace
set foldmethod=indent "fold your code.
set hidden "work with multiple unsaved buffers.
set incsearch "highlights as you search
set ignorecase
set smartcase
set relativenumber number "sets line numbers
@mowshon
mowshon / moviepy-zoom-in-effect.py
Last active July 6, 2024 04:57
Zoom-in Effect for Moviepy. This function makes the zoom effect smoother.
import moviepy.editor as mp
import math
from PIL import Image
import numpy
def zoom_in_effect(clip, zoom_ratio=0.04):
def effect(get_frame, t):
img = Image.fromarray(get_frame(t))
base_size = img.size
@kepano
kepano / obsidian-web-clipper.js
Last active July 22, 2024 07:29
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */