Skip to content

Instantly share code, notes, and snippets.

@mandiwise
mandiwise / Update remote repo
Last active May 2, 2024 08:59
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
@Fanoflix
Fanoflix / ctrl-enter.ts
Last active May 2, 2024 08:56
Ctrl + Enter to submit Form (Typescript)
document.body.addEventListener("keydown", (e: KeyboardEvent) => {
if (!(e.key === "Enter" && (e.metaKey || e.ctrlKey))) return
const form = (e.target as HTMLFormElement).form
if (form) form.submit() // or form.requestSubmit() depending on your usecase
})
@sz763
sz763 / docker_wsl2.md
Last active May 2, 2024 08:55
How to run tests with TestContainers in WSL2 without Docker Desktop

Install docker

in case you haven't docker installed, please follow this instruction https://docs.docker.com/engine/install/ubuntu/

Expose docker port

First way

Create daemon.json file in /etc/docker, with content:

{"hosts": ["tcp://0.0.0.0:2375", "unix:///var/run/docker.sock"]}

Second way suggested by @maireadmccabe-fire

#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf, OVSLink
from subprocess import call
@hoangmirs
hoangmirs / deploy-pm2.md
Last active May 2, 2024 08:43
Deploy pm2 guide

1. Preparing the server

Install git

sudo apt install git-all

Generate Server's SSH public key

ssh-keygen -t rsa -b 4096 -C "deploy"
cat ~/.ssh/id_rsa.pub
@danngreen
danngreen / Makefile-compilecommands.mk
Created November 24, 2020 20:45
Makefile command to generate compile_commands.json with entries for c++ headers
# Addresses an issue where language servers won't know what to do with header files
# since compile_commands.json typically only includes .cc/.cpp/.c files.
#
# Include this file from your main Makefile, or just paste the snippet in.
# To use:
# make compile_commands
# Requires bear and compdb
# bear [osx]: brew install bear
# compdb [see https://github.com/Sarcasm/compdb]: pip install compdb
@iwalpola
iwalpola / stm32_gpio_reg.md
Last active May 2, 2024 08:40
STM32 GPIO registers cheatsheet
@anshoomehra
anshoomehra / parsing10k.ipynb
Last active May 2, 2024 08:39
How to Parse 10-K Report from EDGAR (SEC)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sundowndev
sundowndev / GoogleDorking.md
Last active May 2, 2024 08:38
Google dork cheatsheet

Google dork cheatsheet

Search filters

Filter Description Example
allintext Searches for occurrences of all the keywords given. allintext:"keyword"
intext Searches for the occurrences of keywords all at once or one at a time. intext:"keyword"
inurl Searches for a URL matching one of the keywords. inurl:"keyword"
allinurl Searches for a URL matching all the keywords in the query. allinurl:"keyword"
intitle Searches for occurrences of keywords in title all or one. intitle:"keyword"
@ChipCE
ChipCE / readme.md
Last active May 2, 2024 08:38
Klipper bed mesh on print area only macro install guide

READ THIS FIRST

Adaptive bed mesh is merged into klipper master branch. You can use this feature without this custom macro. Official klipper adaptive bed mesh

Klipper mesh on print area only install guide

What this macro do

  • This macro will dynamically changing the bed mesh area based on the size of the parts will be printed. The fw will only probe on the area that the part will be printed (plus mesh_area_offset value)