Skip to content

Instantly share code, notes, and snippets.

@code-yeongyu
code-yeongyu / .gitconfig
Last active Oct 14, 2022
Gitconfig setup with so many aliases
View .gitconfig
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active Oct 14, 2022
Example on how to export a Google sheet to various formats, includes most PDF options
View exportSpreadsheet.gs
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@RatserX
RatserX / debian-ubuntu-apache-fastcgi-php.md
Last active Oct 14, 2022
Setup Apache, FastCGI and PHP on Debian/Ubuntu for hosting sites on different ports and PHP versions
View debian-ubuntu-apache-fastcgi-php.md

Setup Apache, FastCGI and PHP on Debian/Ubuntu for hosting sites on different ports and PHP versions

Prerequisites

Update the installed packages.

apt update

Install the Ondřej PHP repository.

apt install software-properties-commonsudo

add-apt-repository ppa:ondrej/php

View semantic-commit-messages.md

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@dhollard
dhollard / hello.c
Last active Oct 14, 2022
mon hello world
View hello.c
int main()
{
printf("hello world");
return 0;
}
@MetalArend
MetalArend / swarm.yml
Last active Oct 14, 2022
Run a GitLab Runner on your Swarm
View swarm.yml
version: '3.4'
secrets:
# Find your registration token at: "Your project" > "Settings" > "CI/CD" > "Runners settings" > "Specific Runners" (look for registration token)
# Register it as `GITLAB_REGISTRATION_TOKEN`: `docker secret create GITLAB_REGISTRATION_TOKEN YOUR_REGISTRATION_TOKEN`
GITLAB_REGISTRATION_TOKEN:
external: true
# Find your personal access token at: "Your user account" > "Settings" > "Access Tokens" > "Create personal access token" (for api)
# Register it as `GITLAB_PERSONAL_ACCESS_TOKEN`: `docker secret create GITLAB_PERSONAL_ACCESS_TOKEN <YOUR ACCESS TOKEN>`
@ZipFile
ZipFile / README.md
Last active Oct 14, 2022
Pixiv OAuth Flow
View README.md

Retrieving Auth Token

  1. Run the command:

    python pixiv_auth.py login

    This will open the browser with Pixiv login page.

@nitred
nitred / optimal_mtu.md
Last active Oct 14, 2022
Wireguard Optimal MTU
View optimal_mtu.md

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@uztadh
uztadh / stitch_sso_python.md
Created Aug 24, 2022
Stitch.money SSO with Python
View stitch_sso_python.md

Using Python for Stitch SSO

Overview

This post goes through user Stitch SSO for python-based backends. It covers pretty much the same ground as the Stitch docs but uses Python instead of browser-based Javascript. It should be of help for anyone trying to integrate Stitch in their backend server. Before proceeding, make sure you have both a client_id and client_secret- they are provided by Stitch

@iaverin
iaverin / rest35.py
Last active Oct 14, 2022
Simple and functional REST server for Python (3.5) using no dependencies beyond the Python standard library. Ported from https://gist.github.com/tliron/8e9757180506f25e46d9
View rest35.py
#!/usr/bin/env python
'''
Simple and functional REST server for Python (3.5) using no dependencies beyond the Python standard library.
Ported from original lib for Python 2.7 by Liron (tliron @ github.com) https://gist.github.com/tliron/8e9757180506f25e46d9
Features:
* Map URI patterns using regular expressions
* Map any/all the HTTP VERBS (GET, PUT, DELETE, POST)
* All responses and payloads are converted to/from JSON for you
* Easily serve static files: a URI can be mapped to a file, in which case just GET is supported