Skip to content

Instantly share code, notes, and snippets.

@swiftui-lab
swiftui-lab / tree-layout-example.swift
Last active April 27, 2024 03:55
A Tree Layout Example (SwiftUI)
// Author: SwiftUI-Lab (swiftui-lab.com)
// Description: A Tree Layout example
// blog article: https://swiftui-lab.com/layout-protocol-part-2
import SwiftUI
struct TreeNode: Identifiable {
var parentId: UUID? = nil
let id: UUID = UUID()
let name: String
@padeoe
padeoe / README_hfd.md
Last active April 27, 2024 03:41
CLI-Tool for download Huggingface models and datasets with aria2/wget+git

🤗Huggingface Model Downloader

Considering the lack of multi-threaded download support in the official huggingface-cli, and the inadequate error handling in hf_transfer, this command-line tool smartly utilizes wget or aria2 for LFS files and git clone for the rest.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
  • 🚀 Multi-threaded Download: Utilize multiple threads to speed up the download process.
  • 🚫 File Exclusion: Use --exclude or --include to skip or specify files, save time for models with duplicate formats (e.g., *.bin or *.safetensors).
  • 🔐 Auth Support: For gated models that require Huggingface login, use --hf_username and --hf_token to authenticate.
  • 🪞 Mirror Site Support: Set up with HF_ENDPOINT environment variable.
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 27, 2024 03:41
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@rumansaleem
rumansaleem / clean-up-arch-linux.md
Created May 28, 2019 08:51
Instructions to clean up Arch Linux (Manjaro)

Contents

  • Clean pkg cache
  • Remove unused packages (orphans)
  • Clean cache in /home
  • remove old config files
  • Find and Remove
    • duplicates
    • empty files
    • empty directories
  • broken symlinks
@senthilmpro
senthilmpro / download-file-axios-nodejs.js
Last active April 27, 2024 03:37
Download File using axios : Node.js program
'use strict'
const Fs = require('fs')
const Path = require('path')
const Axios = require('axios')
async function downloadImage () {
const url = 'https://unsplash.com/photos/AaEQmoufHLk/download?force=true'
const path = Path.resolve(__dirname, 'images', 'code1.jpg')
@zhashkevych
zhashkevych / Dockerfile
Last active April 27, 2024 03:37
Wait for Postgres initialization in Docker-Compose
FROM golang:1.14-buster
RUN go version
ENV GOPATH=/
COPY ./ ./
# install psql
RUN apt-get update
RUN apt-get -y install postgresql-client
@ggarcia92
ggarcia92 / verifyEloquentQuery.php
Last active April 27, 2024 03:37
Know queries generated by Eloquent
DB::enableQueryLog();
$val = 1;
$results = Model::with(['relation' => function($q) use ($val){
$q->where('col', $val);
}])->get();
dd(DB::getQueryLog());
@ggarcia92
ggarcia92 / Qr.vue
Last active April 27, 2024 03:36
QrCode Display and Export to PDF in Vue3/Quasar
<template>
<vue-qrcode :value="json" ref="qr" :options="{ width: 200 }"></vue-qrcode>
<q-btn label="Export" @click="exportPDF" />
</template>
<script>
import Jspdf from "jspdf";
export default {
name: "PageIndex",
data() {
@erratir
erratir / Qr.vue
Created March 30, 2021 11:07 — forked from ggarcia92/Qr.vue
QrCode Display and Export to PDF in Vue/Quasar
<template>
<q-page class="flex flex-center">
<qrcode :value="json" ref="qr" :options="{ width: 200 }"></qrcode>
<q-btn label="Export" @click="exportPDF"/>
</q-page>
</template>
<script>
import Jspdf from 'jspdf'
@erratir
erratir / utils.js
Last active April 27, 2024 03:35
convert dd.mm.yyyy to Date
/**
* 'dd.mm.yyyy' to Date
* @param {string} dateStr
* @returns {Date}
*/
const toDate = (dateStr) => {
const [day, month, year] = dateStr.split('.').map(el => parseInt(el))
return new Date(year, month - 1, day)
}