Skip to content

Instantly share code, notes, and snippets.

@ccampores-n26
ccampores-n26 / dsa.kt
Created December 28, 2024 16:00
DSA Cheat Sheet
// Two pointers: one input, opposite ends
fun twoPointers(arr: IntArray): Int {
var left = 0
var right = arr.size - 1
val ans = 0
while (left < right) {
// do some logic here with left and right
if (CONDITION) {
left++
@hellt
hellt / nsp-curl.sh
Last active December 28, 2024 16:03
nsp-curl
while [ $# -gt 0 ]; do
case "$1" in
# IP address or the domain name of the NSP server (without http(s) schema)
--nsp_url=*)
NSP_URL="${1#*=}"
;;
# http proxy which will be used by curl if set
--proxy=*)
HTTP_PROXY="${1#*=}"
;;
@yknext
yknext / config.json
Last active December 28, 2024 16:01
使用gost和iptables实现socks5透明代理
# gost配置 /opt/gost/config.json
# https://github.com/ginuerzh/gost
{
"ServeNodes":[
"redirect://:65500"
],
"ChainNodes":[
"socks://192.168.200.144:11080"
]
}
@1oh1
1oh1 / optiplex-3060-enable-pcie3.md
Last active December 28, 2024 15:59
Dell OptiPlex 3060 - Enable NVMe Gen 3 speeds (Enable PCIe 3.0)

Enable PCIe 3.0 speeds for NVMe SSDs on Dell OptiPlex 3060

Out of the box, any M.2 NVMe SSDs connected to the Dell OptiPlex 3060 runs at PCIe Gen 2.0 speeds (Max 5 GT/s; 2 GB/s) so the speed tests look like this:

screen1

However, after this BIOS mod, the SSD can reach PCIe Gen 3.0 speeds (Max 8 GT/s; 3.9 GB/s) so the speed tests look like this:

screen2

@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active December 28, 2024 15:55
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

<svg width="300" height="300" viewBox="0 0 300 300">
<defs>
<filter id="paperEffect">
<feTurbulence
type="fractalNoise"
baseFrequency="0.04"
numOctaves="5"
result="noise"
/>
<feDiffuseLighting
@ccampores-n26
ccampores-n26 / .gitconfig
Created December 28, 2024 15:38
.gitconfig
[alias]
s = status
a = add
co = checkout
cm = commit -m
amend = commit --amend -m
@ccampores-n26
ccampores-n26 / FileHostingService.kt
Last active December 28, 2024 15:54
Demo FileHostingService
import java.time.Instant
data class File(
val filename: String,
val size: Int,
val createdAt: Long? = null,
val ttlSec: Long? = null
) {
fun isAlive(timestamp: Long): Boolean {
if (ttlSec == null || createdAt == null)
#version 300 es
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
out vec4 fragColor;
uniform vec2 resolution;
uniform vec3 orientation;
@aaani
aaani / N-wayMerge.cpp
Last active December 28, 2024 15:41
Here is an implementation for N-way merge using priority queue data structure. Code requires n sorted vector<int> as input and generates one huge vector containing the result of merge of input vectors. The worst case time complexity of this algorithm is O(m * log(m)) where m is the total number of elements in all the lists.
// MergeK
//
// Created by Anirvana Mishra on 6/18/13.
// Copyright (c) 2013 Anirvana Mishra. All rights reserved.
//
#include <iostream>
#include <vector>
#include <queue>
using namespace std;