Skip to content

Instantly share code, notes, and snippets.

@Amoenus
Amoenus / nginx-proxy-manager-dark-theme.css
Last active May 22, 2022
nginx proxy manager dark theme
View nginx-proxy-manager-dark-theme.css
a {
color: rgb(140, 140, 250);
}
::-webkit-scrollbar-track-piece {
background-color: rgba(255, 255, 255, 0.2) !important;
}
::-webkit-scrollbar-track {
background-color: rgba(255, 255, 255, 0.3) !important;
}
::-webkit-scrollbar-thumb {
@jianminchen
jianminchen / LC347_KMostFrequentNumbers1.cpp
Created Jul 29, 2016
Leetcode 347 - top k frequent elements in the array - C++ solution to study - code source: https://www.hrwhisper.me/leetcode-top-k-frequent-elements/
View LC347_KMostFrequentNumbers1.cpp
typedef pair<int, int> P;
class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int, int> cnt;
for (int x : nums) cnt[x] ++;
priority_queue<P, vector<P>, greater<P> > q;
for (auto &x : cnt) {
if (q.size() < k)
q.push(make_pair(x.second, x.first));
View confettiandsinelon.ino
void confettiandsinelon()
{
// a colored dot sweeping back and forth, with fading trails
fadeToBlackBy( leds, NUM_LEDS, 10);
int pos1 = beatsin16(4, 0, NUM_LEDS - 1); //beats_per_minute, uint16_t lowest=0, uint16_t highest=65535, uint32_t timebase=0, uint16_t phase_offset=0
leds[pos1] += CHSV( gHue, 255, 192);
int pos2 = random16(NUM_LEDS);
int pos3 = random16(NUM_LEDS);
int pos4 = random16(NUM_LEDS);
EVERY_N_MILLIS(200) {
@bradtraversy
bradtraversy / typescript-crash.ts
Last active May 22, 2022
Basic intro to TypeScript (From YouTube Crash Course)
View typescript-crash.ts
// Basic Types
let id: number = 5
let company: string = 'Traversy Media'
let isPublished: boolean = true
let x: any = 'Hello'
let ids: number[] = [1, 2, 3, 4, 5]
let arr: any[] = [1, true, 'Hello']
// Tuple
@yovko
yovko / ohmyzsh.md
Last active May 22, 2022
ZSH (using Oh My ZSH) on Manjaro Linux
View ohmyzsh.md

ZSH (using Oh My ZSH) on Manjaro Linux

0. If ZSH is not already installed on your Manjaro system you can do it with the command:

sudo pacman -Syu zsh

You do not need to install manjaro-zsh-config and all the other related packages like zsh-syntax-highlighting, zsh-history-substring-search, zsh-autosuggestions, etc., as we will use Oh My Zsh.

@oooh-boi
oooh-boi / gist:a2e47433443125887d20aafd5cec7388
Created Jan 18, 2020
OoohBoi Video Tutorial : Full-height Image Widget in Elementor PRO
View gist:a2e47433443125887d20aafd5cec7388
/* be sure to copy-paste to the Image Widget Custom CSS panel */
selector,
selector .elementor-widget-container,
selector .elementor-image,
selector .elementor-image > a {
height: 100%;
}
selector .elementor-image img {
object-fit: cover;
object-position: 50% 50%;
@Klerith
Klerith / instalaciones-javascript-curso.md
Last active May 22, 2022
Instalaciones recomendadas - Curso de JavaScript
View instalaciones-javascript-curso.md
@zzzeek
zzzeek / asyncio_plus_greenlet.py
Last active May 22, 2022
An asyncio program that runs rows into a Postgresql database, using blocking style code to actually run the database commands
View asyncio_plus_greenlet.py
"""This program is exactly the same as that of
https://gist.github.com/zzzeek/33943060f7a08cf9e82bf8df1f0f75de ,
with the exception that the add_and_select_data function is written in
synchronous style.
UPDATED!! now includes refinements by @snaury and @Caselit . SIMPLER
AND FASTER!!
@amerryma
amerryma / TestComponent-nock.test.tsx
Created May 19, 2022
Supabase Mocking (Regular Mocking vs API Nock)
View TestComponent-nock.test.tsx
import '@testing-library/jest-dom'
import { render } from '@testing-library/react'
import { renderHook } from '@testing-library/react-hooks'
import nock from 'nock'
import TestComponent from './TestComponent'
const mockResultData = [
{
@sjohnr
sjohnr / Authorization.java
Last active May 22, 2022
JpaOAuth2AuthorizationService for Spring Authorization Server
View Authorization.java
/*
* Copyright 2020-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software