Skip to content

Instantly share code, notes, and snippets.

View a-toms's full-sized avatar
🌱
Ecstatic!

Tom a-toms

🌱
Ecstatic!
View GitHub Profile
@sebastianschramm
sebastianschramm / boto3_s3_upload_tqdm_progressbar.py
Created August 13, 2022 09:17
Show tqdm progress bar while uploading file to S3 with boto3
from pathlib import Path
import boto3
from tqdm import tqdm
def upload_to_s3(
file_name: str,
target_bucket_name: str,
target_object_name: str,
@kzaremski
kzaremski / AppleNotesExporter.applescript
Last active August 8, 2023 08:56
Apple Notes Exporter Script (AppleScript)
--
-- ** AppleNotesExporter **
-- -- Easily export Apple notes to standard encoding HTML preserving directory structure
--
-- Copyright 2022 Konstantin Zaremski
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
-- documentation files (the "Software"), to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
-- and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@Stiropor
Stiropor / auth.js
Last active September 8, 2022 14:38
Nuxt3 auth demo
import { nextTick } from 'vue'
export const useProperCookie = () => useCookie('proper_token')
export const useAuthFetch = (url, fetchOptions = {}) => {
return $fetch(url, {
baseURL: 'https://l9.test/api/v1',
...fetchOptions,
headers: {
Authorization: `Bearer ${useProperCookie().value}`,
...fetchOptions.headers,
@amerryma
amerryma / TestComponent-nock.test.tsx
Created May 19, 2022 15:55
Supabase Mocking (Regular Mocking vs API Nock)
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 = [
{
@kepano
kepano / obsidian-web-clipper.js
Last active May 7, 2024 17:33
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
from django.test import TestCase
from django.contrib import auth
class BaseAuthTestCase(TestCase):
def assertLoggedInAs(self, user):
client_user = auth.get_user(self.client)
self.assertEqual(client_user, user)
assert client_user.is_authenticated()
@nayanseth
nayanseth / 01 - Comments
Last active June 20, 2023 03:58
Basics of AppleScript
(*
Script - Comments
@author - Nayan Seth
© Tech Barrack Solutions Pvt Ltd
*)
--This is a single line comment
#This is a comment too but still single line
(*
@adamlj
adamlj / send_mailgun_attachments.py
Created January 23, 2014 10:53
MailGun API Python Requests multiple Attachments Send mail with multiple files/attachments with custom file names
requests.post("https://api.mailgun.net/v2/DOMAIN/messages",
auth=("api", "key-SECRET"),
files={
"attachment[0]": ("FileName1.ext", open(FILE_PATH_1, 'rb')),
"attachment[1]": ("FileName2.ext", open(FILE_PATH_2, 'rb'))
},
data={"from": "FROM_EMAIL",
"to": [TO_EMAIL],
"subject": SUBJECT,
"html": HTML_CONTENT