Skip to content

Instantly share code, notes, and snippets.

@bryanbuchanan
bryanbuchanan / GetShapeArea.jsx
Last active March 29, 2024 10:27
Script to find the area of shapes in Adobe Illustrator
/* Save this file with a jsx extension and place in your
Illustrator/Presets/en_US/Scripts folder. You can then
access it from the File > Scripts menu */
var decimalPlaces = 3;
if (app.documents.length > 0) {
if (app.activeDocument.selection.length < 1) {
alert('Select a path');
@TABASCOatw
TABASCOatw / solana_repositories.json
Created May 5, 2023 19:10
Indexed Solana Repositories April 2023 (expect 2% false positives)
{
"chainify": "https://github.com/liquality/chainify",
"solana-chat-app": "https://github.com/jsoneaday/solana-chat-app",
"wallet-adapter": "https://github.com/solana-labs/wallet-adapter",
"audius-protocol": "https://github.com/AudiusProject/audius-protocol",
"raydium-ui": "https://github.com/raydium-io/raydium-ui",
"espresso-cash-public": "https://github.com/espresso-cash/espresso-cash-public",
"backpack": "https://github.com/coral-xyz/backpack",
"projects": "https://github.com/solidproof/projects",
"protocol-v1": "https://github.com/drift-labs/protocol-v1",
@ZipFile
ZipFile / README.md
Last active March 29, 2024 10:26
Pixiv OAuth Flow

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@yqritc
yqritc / gist:ccca77dc42f2364777e1
Last active March 29, 2024 10:25
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@shitchell
shitchell / git-user-stats
Last active March 29, 2024 10:23
Show user stats in a git repo
#!/bin/bash
#
# Show user stats (commits, files modified, insertions, deletions, and total
# lines modified) for a repo
git_log_opts=( "$@" )
git log "${git_log_opts[@]}" --format='author: %ae' --numstat \
| tr '[A-Z]' '[a-z]' \
| grep -v '^$' \
@jtadeulopes
jtadeulopes / server.md
Last active March 29, 2024 10:23
Server setup with ubuntu, nginx and puma for rails app.

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone

@jiahao87
jiahao87 / pegasus_fine_tune.py
Last active March 29, 2024 10:20
Pytorch script for fine-tuning Pegasus Large model
"""Script for fine-tuning Pegasus
Example usage:
# use XSum dataset as example, with first 1000 docs as training data
from datasets import load_dataset
dataset = load_dataset("xsum")
train_texts, train_labels = dataset['train']['document'][:1000], dataset['train']['summary'][:1000]
# use Pegasus Large model as base for fine-tuning
model_name = 'google/pegasus-large'
train_dataset, _, _, tokenizer = prepare_data(model_name, train_texts, train_labels)
@Stanback
Stanback / nginx.conf
Last active March 29, 2024 10:20 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@rserafim
rserafim / next.config.js
Created December 3, 2023 17:01
Next Config redirects Bots
const withPWA = require('next-pwa')
module.exports = withPWA({
async redirects() {
return [
{
source: "/(.*)",
has: [
{
type: "header",
key: "User-Agent",
@caruccio
caruccio / migrate-pv-to-zone.sh
Last active March 29, 2024 10:17
Migrate EBS Volume based PVs across AWS availability zones
#!/bin/bash
if [ $# -lt 6 ]; then
echo "Usage: $0 [source-namespace] [source-pvc-name] [target-namespace] [target-pvc-name] [target-aws-zone] [target-pv-name] [kind/workload=None]"
echo "Clone EBS, PV and PVC from source to target. Will stop kind/workload if defined."
exit
fi
set -eu