Skip to content

Instantly share code, notes, and snippets.

@Explosion-Scratch
Explosion-Scratch / Quizlet flashcards.js
Created October 12, 2021 23:55
Get Quizlet flashcards via API
async function quizlet(id){
let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=1`).then(res => res.json())
let currentLength = 5;
let token = res.responses[0].paging.token
let terms = res.responses[0].models.studiableItem;
let page = 2;
console.log({token, terms})
while (currentLength >= 5){
let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=${page++}&pagingToken=${token}`).then(res => res.json());
terms.push(...res.responses[0].models.studiableItem);
@gzxu
gzxu / README.md
Last active May 24, 2024 19:57
Run rsync server on Android Termux

Usually we will use this command

rsync --dry-run -a --mkpath --no-o --no-g --no-p -P -c SRC/ DST/

Remove --dry-run to actually copy the files rather than merely comparing

Remove -c to make it faster by comparing mod-time and size rather than checksum

@danielhunex
danielhunex / hosted-services-dotnet-core.md
Last active February 21, 2023 20:48
Hosted Services in .Net Core
 
public class HelloContext
{
   private ISomething _smh ; 
     void Foo(string key)
    {
       switch(key)
        {
 case "A":
@kekru
kekru / 01nginx-tls-sni.md
Last active August 17, 2025 18:13
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
set ignorecase
set smartcase
set scrolloff=3 " 3 lines above/below cursor when scrolling
" Emulated Plugins
set surround
" set easymotion
set NERDTree
" Copy to system clipboard as well
@lorentzca
lorentzca / index.html
Created October 4, 2016 15:07
ghost blog insite search box by algolia
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
.algolia-autocomplete {
width: 80%;
max-width: 710px;
}
.algolia-autocomplete .aa-input, .algolia-autocomplete .aa-hint {
width: 100%;
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active August 31, 2025 10:55
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@DarrenN
DarrenN / get-npm-package-version
Last active June 20, 2025 19:20 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@lalyos
lalyos / dnstest.go
Created June 13, 2015 08:23
DNS SRV record test in golang
package main
import (
"fmt"
"net"
"os"
)
func main() {
if len(os.Args) < 2 {
@azproduction
azproduction / cl.js
Last active August 29, 2015 14:11
WebStorm Live Templates
console.log($LINE$);
// LINE = lineNumber()