Skip to content

Instantly share code, notes, and snippets.

@mrd000
mrd000 / bitbucket_pr.py
Last active October 17, 2023 19:50
create bitbucket PR
import requests
# Set the Bitbucket username and password
username = "YOUR_BITBUCKET_USERNAME"
password = "YOUR_BITBUCKET_PASSWORD"
# Set the repository name and branch name
repository_name = "YOUR_REPOSITORY_NAME"
branch_name = "YOUR_BRANCH_NAME"
// https://leetcode.com/problems/logger-rate-limiter/
const (
message_throttle_interval = 10 // seconds
prime32 = uint32(16777619)
)
// https://github.com/segmentio/fasthash
func hash(s string) uint32 {
h := uint32(2166136261)
// https://leetcode.com/problems/interval-list-intersections/
func intervalIntersection(firstList [][]int, secondList [][]int) [][]int {
var result [][]int
if len(firstList) == 0 || len(secondList) == 0 {
return result
}
firstListPos := 0
secondListPos := 0
for ; firstListPos < len(firstList) && secondListPos < len(secondList) ; {
// https://leetcode.com/problems/multiply-strings
func multiply(num1 string, num2 string) string {
res := make([]rune, len(num1)+len(num2))
for i := range res {
res[i] = 48 // preinitialize with 0s
}
for i:=len(num1)-1; i >=0; i-- {
for j:=len(num2)-1; j>=0; j-- {
mul := (rune(num1[i]) - 48) * (rune(num2[j]) - 48)
res[i+j+1] += mul
@mrd000
mrd000 / refresh.js.diff
Created October 30, 2018 10:11
Vertical Tabs patch
--- refresh.js.orig 2017-03-08 21:36:04.000000000 +0000
+++ refresh.js 2018-10-30 10:01:13.043588200 +0000
@@ -53,18 +53,15 @@
// compatibility with Tab suspender extension
if (tab.favIconUrl != undefined && tab.favIconUrl.match("data:image/png;base64") != null){
$("#f_"+tab.id).css({"background-image": "url("+tab.favIconUrl+")"});
- return;
- }
// change favicon
- if (tab.url.match("opera://|browser://|chrome://|chrome-extension://") != null || !tab.favIconUrl){