Skip to content

Instantly share code, notes, and snippets.

@aclarknexient
aclarknexient / ublock.txt
Created October 13, 2023 13:43
ublock origin hackernews dark mode and narrower comment display
! The following 2 lines are what I use to display news.ycombinator.com
! Limit comments to 70 characters wide, making them easier to read
news.ycombinator.com##.comment:style(max-width: 70ch !important; overflow: hidden !important;)
! Invert the colours of the site, making a dark mode that I like
! `invert(95%)` does most of the work,
! but you can tweak the hue-rotate value to fine tune the colours
news.ycombinator.com##html:style(filter:invert(95%) hue-rotate(200deg); background: white)
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@33eyes
33eyes / commit_jupyter_notebooks_code_to_git_and_keep_output_locally.md
Last active May 2, 2024 16:19
How to commit jupyter notebooks without output to git while keeping the notebooks outputs intact locally
  1. Add a filter to git config by running the following command in bash inside the repo:
git config filter.strip-notebook-output.clean 'jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to=notebook --stdin --stdout --log-level=ERROR'  
  1. Create a .gitattributes file inside the directory with the notebooks

  2. Add the following to that file:

*.ipynb filter=strip-notebook-output  
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 2, 2024 16:19
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@mjbalcueva
mjbalcueva / password-input.tsx
Last active May 2, 2024 16:19
shadcn ui custom password input
"use client"
import { forwardRef, useState } from "react"
import { EyeIcon, EyeOffIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input, InputProps } from "@/components/ui/input"
import { cn } from "@/lib/utils"
const PasswordInput = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {
@amakukha
amakukha / Play2Tones.ino
Last active May 2, 2024 16:18
Play duo melody with Arduino
/*
* Play duo melody with Arduino
* ============================
*
* Description:
* This sketch simultaneously plays two separate melodies on two (passive)
* speakers or buzzers. This creates effect of a "choir".
* For simplicity, it uses function play2Tones(), which only plays two notes
* of equal duration simultaneosly.
* The actual melody here is the Anthem of Ukraine.
@cruxrebels
cruxrebels / PowerOfTwoIntegers.cpp
Created April 27, 2016 19:12
Given a positive integer which fits in a 32 bit signed integer, find if it can be expressed as A^P where P > 1 and A > 0. A and P both should be integers. Example Input : 4 Output : True as 2^2 = 4. Tags: InterviewBit Math Problem https://www.interviewbit.com/problems/power-of-two-integers/
bool Solution::isPower(int A) {
if (A<2)
return true;
for (auto i = 2; i<=sqrt(A); ++i)
{
for (auto j = 2; j<=32; ++j)
{
if(pow(i, j)==A)
return true;
@boppreh
boppreh / Programming Language Checklist 2024.txt
Last active May 2, 2024 16:15
Updated version of the tongue-in-cheek Programming Language Checklist
Programming Language Checklist
by Colin McMillen, Jason Reed, and Elly Fong-Jones, 2011-10-10
updated by BoppreH, 2024-01-24
You appear to be advocating a new:
[ ] functional [ ] imperative [ ] object-oriented [ ] stack-based [ ] concurrent
[ ] interpreted [ ] compiled [ ] JIT [ ] cloud [ ] AI [ ] beginner-friendly
[ ] academic-friendly [ ] visual [ ] sharable [ ] esoteric
[ ] memory safe [ ] memory unsafe [ ] provable [ ] Turing-incomplete
[ ] statically-typed [ ] dynamically-typed [ ] completely incomprehensible
@alejandro-martin
alejandro-martin / multiple-ssh-keys-git.adoc
Last active May 2, 2024 16:12
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

@naoki-sawada
naoki-sawada / client.js
Last active May 2, 2024 16:11
Simple socket.io room and auth example
const io = require('socket.io-client');
const socket = io('http://localhost:3000', {
transportOptions: {
polling: {
extraHeaders: {
'Authorization': 'Bearer abc',
},
},
},