Skip to content

Instantly share code, notes, and snippets.

View bunnykek's full-sized avatar
🍉
Focusing

bunny bunnykek

🍉
Focusing
View GitHub Profile
@bunnykek
bunnykek / fyne_windows.md
Created February 8, 2024 10:56
Installing fyne in Microsoft Windows Go lang

These are the steps which I have followed and it worked for me.

  1. Download Go from the download page and follow instructions. https://golang.org/dl/
  2. Install TDM-GCC compiler https://jmeubank.github.io/tdm-gcc/download/
  3. Make a new project folder and open it in VS code.
  4. run the below commands one by one
go mod init MODULE_NAME
go get fyne.io/fyne/v2@latest
go install fyne.io/fyne/v2/cmd/fyne@latest
1. Security Values
ALL The 26 characters of the alphabet are each assigned a security value represented as an array of integers, where security values[i] is associated with the character of the alphabet. Given an encrypted message, msg, and the array security values, rearrange the characters in msg and find the minimum possible sum of the absolute differences of the security values of adjacent characters.
Example
Given security values[i]-[1, 2, 1, 3, 1, 3, 5, 7, 1, 1, 5, 5, 8, 10, 11, 1, 23, 2, 3, 7, 8, 9, 1, 6, 5, 9] and s = "afeb".
Here 'a' relates to 1, 'f' relates to 3, 'e' relates to 1,
and 'b' relates to 2. Some of the rearrangements are:
Rearrangement
Adjacent Difference
Moving Rabbits
Problem Description
There are N rabbits standing on an infinite number line. Every rabbit has some specific charcateristic represented by lowercase latin letters given by string A
Initially they are at some integer position By They will start moving when you order them with 1 unit per second Their initial direction will be given by an integer array C, which contains only 1 or-1 I mean that rabbit will move in positive direction or right side of the number line, and -1 mean opposite direction. If two rabbits with same characteristic value meet they will change their direction of movement. Find the sum of distance of all the the possible pair of rabbits after D seconds when you ordered them to move.
Problem Constraints
Acone Twilio product that we offer customers is the ability to send text messages programmatically. With a simple line of code, you send a user either an SMS (text- based) or MMS (media-based) message. While sending and receiving images is a common use case for customers, there are bandwidth limits for the size of each text message. For each channel that the user uses to send a message, there is a fixed bandwidth that cannot be exceeded.
We are given two lists.
1. List A represents the required bandwidth for each message, and
2. List B represents the available bandwidth for each channel.
We are given the available bandwidths of each channel in List B. For each of these channels, compute the total number of messages in List A that meet the below criteria:
• Each message in List A should require a bandwidth that is less than or equal to the available bandwidth of a channel in List B.
int main() {
vector<int> lista = {1, 2, 3};
@bunnykek
bunnykek / good_array.cpp
Created October 18, 2023 10:11
good array
// An array A[i] of size N and a single integer K are given.You must create a good array G[i] of size N.The good array G[i] is the array in which the i ^ (th) elementdenotes the number of elements of the array present betweenrange A[i] - K, A[i] + K ] (inclusively).
// Find the good array G[i] of size N.
vector<int> solve(vector<int> &v, int &k){
auto s = v;
sort(s.begin(), s.end());
vector<int> ans;
for(auto num: v){
auto lp = lower_bound(s.begin(), s.end(), num-k) - s.begin();
auto hp = lower_bound(s.begin(), s.end(), num+k+1) - s.begin();
@bunnykek
bunnykek / onebox.cpp
Created October 18, 2023 07:55
One box
// You are working in the resource distribution team of your company A One block is a block of data having exactly one resource which has vatus 1 You are given an array
// A containing N resource values What is the number of ways to divide the array into continuous blocks such that each block
```
int main() {
vector<int> v = {0 ,1, 0};
int n = v.size();
vector<int> dp(n+1, 1);
for(int i=n-1; i>=0; i--){
int count = 0, sum = 0;
@bunnykek
bunnykek / amusic_formats.user.js
Last active June 2, 2024 18:54 — forked from uhwot/amusic_formats.user.js
Apple Music Formats Userscript
// ==UserScript==
// @name Apple Music Formats
// @namespace io.github.uhwot.amusicformats
// @match https://music.apple.com/*
// @grant none
// @run-at document-start
// @version 1.0.2
// @author uh wot
// @description Shows formats available on Apple Music albums. Based on https://github.com/bunnykek/AppleMusic-Formats-Extension
// @icon https://music.apple.com/assets/favicon/favicon-180-f10a76334177ea08c0b3b35b0269fe16.png
@bunnykek
bunnykek / run.py
Created October 16, 2022 16:59
Compiles all the images into a single pdf
#put this run.py file in the folder containing all the images.
from PIL import Image
import os
image_list = []
files = os.listdir()
image_files = []
for i in range(len(files)):
if files[i].endswith(".png"): #change the "png" according to the requirements.
@bunnykek
bunnykek / playlistToAlbums.py
Last active April 18, 2022 09:57
Exports Apple-Music playlist into unique_album_links_list.txt
# mini script by bunny
# exports apple-music playlist into unique_albums_list.txt
import requests
import re
headers = {
'authorization': 'Bearer eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IldlYlBsYXlLaWQifQ'
'.eyJpc3MiOiJBTVBXZWJQbGF5IiwiaWF0IjoxNjQ0OTQ5MzI0LCJleHAiOjE2NjA1MDEzMjR9.3RUn173ddFRpam0ksOFS'
'-vJFR-wCtJHzcSdGr7exxFQScWxzQxHGht4wyt6iJQqNcEOR4BRmv6O4-2B4jzrGsQ',
@bunnykek
bunnykek / someonesay.js
Created April 13, 2021 05:30
someonesay
/* Codded by @phaticusthiccy
Telegram: t.me/phaticusthiccy
Instagram: www.instagram.com/kyrie.baran
*/
const Asena = require('../events');
const { MessageType, MessageOptions, Mimetype } = require('@adiwajshing/baileys');
const fs = require('fs');
const axios = require('axios');
const Config = require('../config');