Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#define da_append(xs, x) \
do { \
if ((xs)->count >= (xs)->capacity) { \
if ((xs)->capacity == 0) (xs)->capacity = 256; \
else (xs)->capacity *= 2; \
(xs)->items = realloc((xs)->items, (xs)->capacity*sizeof(*(xs)->items)); \
} \
@riggaroo
riggaroo / KeyframesWithSpline.kt
Created December 17, 2024 11:34
KeyframesWithSpline Example
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.VectorConverter
import androidx.compose.animation.core.animateValue
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.keyframesWithSpline
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
@subfuzion
subfuzion / curl.md
Last active December 26, 2024 15:28
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@msmuenchen
msmuenchen / 00_MAIN.md
Last active December 26, 2024 15:26
Patching around the Samsung Wearable ecosystem for fun and (no) profit

tl;dr: Samsung is a bunch of crap company that doesn't inform their customers about serious limitations on their Wearables lineup. Great hardware, dog poo software.

So, what's this about: Samsung omits a bunch of crucial information for consumers anywhere on the Galaxy Watch product pages - at least on those for the Galaxy Watch 4, Galaxy Watch 5 or Galaxy Watch 6.

They omit on the product pages, the pages that should inform a consumer about requirements and limitations, that:

  1. unless you're rooted, the companion phone actually must be a phone, tablets and even phablets like the Galaxy Tab Active 3 are not supported. (If you're rooted, you can patch that away. Just follow along for the guide)
  2. only certain wearables
@mwaskom
mwaskom / replacing_seaborn_distplot.ipynb
Last active December 26, 2024 15:24
A guide to replacing the deprecated `seaborn.distplot` function.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gabeosx
gabeosx / obsidian-livesync-synology.md
Created December 10, 2022 20:59
Obsidian LiveSync Self-Hosted on Synology

Intro

obsidian-livesync is an Obsidian plugin, which allows you to Synchronize your Obsidian vault between devices, using a CouchDB database.

Synology NAS devices offer Docker support, which is a convenient way to host your CouchDB.

Setup the CouchDB container on Synology

Pre-requisites

  1. Create a directory for your Docker data (e.g. /volume1/docker/obsidian-couchdb)
  2. Create a user with permissions to that directory - put them in the users group
@SamadiPour
SamadiPour / snappfood.js
Last active December 26, 2024 15:14
Snappfood Spent money
cookies = Object.fromEntries(document.cookie.split('; ').map(c => c.split('=')));
let UDID = cookies.UDID;
let jwt = cookies[['jwt-access_token']] ?? JSON.parse(window.localStorage.JWT ?? '{}').access_token;
var myHeaders = new Headers();
myHeaders.append("authority", "snappfood.ir");
myHeaders.append("accept", "application/json, text/plain, */*");
myHeaders.append("accept-language", "en-US,en;q=0.9,fa;q=0.8");
myHeaders.append("authorization", "Bearer " + jwt);
myHeaders.append("content-type", "application/x-www-form-urlencoded");
@disler
disler / README.md
Last active December 26, 2024 15:12
Four Level Framework for Prompt Engineering

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Create Free AWS Account

Create free AWS Account at https://aws.amazon.com/

2. Create and Lauch an EC2 instance and SSH into machine

I would be creating a t2.medium ubuntu machine for this demo.

@alexpchin
alexpchin / Setting_upa_new_repo.md
Last active December 26, 2024 15:10
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"

git remote add origin [email protected]:alexpchin/.git