Skip to content

Instantly share code, notes, and snippets.

@PrinceSinghhub
PrinceSinghhub / 22 Key DSA Patterns with Must-Solve Problems! 💡.md
Last active March 5, 2025 07:48
After solving and observing many interview problems, I’ve identified key patterns that will help you solve them.

Problem-Solving Techniques and Patterns

1. Fast and Slow Pointer

Description: This technique uses two pointers moving at different speeds to solve problems involving cycles, such as finding the middle of a list, detecting loops, or checking for palindromes.

  • Linked List Cycle II
  • Remove nth Node from the End of List
  • Find the Duplicate Number
  • Palindrome Linked List
@Ned-Tom
Ned-Tom / Synology Nas M2 NVME - Instructions.md
Last active March 5, 2025 07:49
Unsupported M2 NVME drive pool on Synology Nas

Unsupported M2 NVME drive pool on Synology Nas

WARNING!, do this at your own risk, i'm not responsile for anything!

Pre start

  1. Install unsupported M2 NVME drive in your nas
  2. Enable SSH on your nas

Enable drive

  1. cd /run/synostorage/disks/ Here you sould find your NVME drive like "nvme0n1"
  2. cd nvme0n1 Here sould be a file named "m2_pool_support"
@muendelezaji
muendelezaji / bash-to-zsh-hist.py
Created October 5, 2016 14:18 — forked from op/bash-history-to-zsh-history.py
Convert Bash history to Zsh history
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is how I used it:
# $ cat ~/.bash_history | python bash-to-zsh-hist.py >> ~/.zsh_history
import sys
import time
@sunmeat
sunmeat / AlexDialog.java
Last active March 5, 2025 07:47
extended alert dialog
package com.alex.dialogs;
import android.app.Dialog;
import android.os.Bundle;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
import android.content.DialogInterface;
@taktran
taktran / Makefile
Created December 11, 2018 12:55
Test makefile playground
HELLO_FILE_NAME := ".hello"
tidy-hello:
-rm $(HELLO_FILE_NAME)
save-hello: tidy-hello write-to-hello
write-to-hello:
echo "save this hello" > $(HELLO_FILE_NAME)
@miguelgmalpha
miguelgmalpha / gist:5c9e78d16312d156b0ec1d1c1bb09c1c
Last active March 5, 2025 07:46
AWS Client VPN with SAML for Fedora
The AWS Client VPN for Linux is only provided for Ubuntu as a .deb package. I need it for Fedora. This was tested on Fedora 33.
https://docs.aws.amazon.com/vpn/latest/clientvpn-user/client-vpn-connect-linux.html
Get the vpn client deb package.
```
curl https://d20adtppz83p9s.cloudfront.net/GTK/latest/awsvpnclient_amd64.deb -o awsvpnclient_amd64.deb
```
Install `alien` to convert the deb package to rpm.
@jgornick
jgornick / gist:3786127
Created September 26, 2012 04:47
JavaScript: Parse multiple JSON documents from string
/**
* Parses a string containing one or multiple JSON encoded objects in the string.
* The result is always an array of objects.
*
* @param {String} data
* @return {Array}
*/
function parseJson(data) {
data = data.replace('\n', '', 'g');
@phillipharding
phillipharding / Add-ValidateUpdateListItems.js
Last active March 5, 2025 07:43
SharePoint REST API Add/ValidateUpdateListItems
See:
- https://robertschouten.com/2018/04/30/update-file-metadata-with-rest-api-using-validateupdatelistitem-method/
- http://blog.arvosys.com/2018/07/06/list-items-system-update-options-in-sharepoint-online/index.html
FieldValues =
[
// Text field (single line and note)
{ FieldName: "TextField", FieldValue: "123" },
// Number field
@oNguyenNgocTrung
oNguyenNgocTrung / postgres_command.md
Last active March 5, 2025 07:41
Tổng hợp những câu lệnh khi dùng Postgres SQL

Code Bash command prefix detection

This defines risk levels for actions that the ${K4} agent may take. This classification system is part of a broader safety framework and is used to determine when additional user confirmation or oversight may be needed.

Command prefix extraction examples

Examples:

  • cat foo.txt => cat
  • cd src => cd