Skip to content

Instantly share code, notes, and snippets.

View artemgordinskiy's full-sized avatar

Artem Gordinskiy artemgordinskiy

View GitHub Profile
@artemgordinskiy
artemgordinskiy / coolify.docker-compose.yml
Created September 25, 2024 07:22
Example Coolify Django Docker Compose file
version: '3.8'
services:
my_app_web:
build:
context: .
dockerfile: Dockerfile.web
environment:
PORT: ${PORT}
DJANGO_SETTINGS_MODULE: my_app.settings_production
@artemgordinskiy
artemgordinskiy / README.md
Last active December 23, 2023 07:25
Forcing the 80% battery limit on ARM macs using fish 🐟

See the instructions on install smc here, then append the snippet below to your ~/.config/fish/config.fish, if you use fish instead of the z shell.

Credit for rewriting to the fish syntax goes to ChatGPT 🙃

@artemgordinskiy
artemgordinskiy / e.bash
Created November 25, 2022 15:35
Run Apache Benchmark with custom headers/cookies
ab -l -n 100 -c 10 -H "cookie: tobedippedin=milk;" "https://ddos.me"
# -l is for supporting variable length responses
# 100 requests in total with concurrency of 10
@artemgordinskiy
artemgordinskiy / read.md
Last active November 22, 2022 11:56
Undo multiple MRs to the main branch in git

Assuming there were one or more bad merges to the current branch and we want to go back to a cetain (merge, or otherwise) commit before them:

git checkout <good-commit-hash> -- .

This will stage all file changes without checking out any branch or putting it into a weird state.

Not that any files added since said commit will not be removed automatically, so they may need to be deleted manually.

@artemgordinskiy
artemgordinskiy / trigger_customer_io_event_with_attachments.py
Last active August 6, 2018 09:13
Trigger Customer.io event with attachments in Python
import base64
import requests
from customerio import CustomerIO
file_content = requests.get(file_url).content
file_base64 = base64.b64encode(file_content)
customer_io = CustomerIO(site_id, api_key)
customer_io.track(
@artemgordinskiy
artemgordinskiy / gist:1e6c17dfd5f60cc3e963
Last active December 24, 2015 11:22
Run PHP inside Docker inside CodeRunner
// enter this in the "Run Command" field in CodeRunner preferences
eval "$(docker-machine env default)" && docker run --rm php:7.0.1-cli php -r "$(sed 's/^<\?php//' $filename)"
@artemgordinskiy
artemgordinskiy / node-npm-in-docker.sh
Created December 11, 2015 14:00
Run Node/NPM in a Docker container
# For example, run "npm install"
docker run -v "$PWD":/usr/src/app -w /usr/src/app node:4 npm install
# This command creates a container (downloading one first if you don't have it locally), runs the command in a current directory and quits the container
# Great Success!
@artemgordinskiy
artemgordinskiy / install-zray.sh
Created December 9, 2015 14:37
Install Z-Ray for PHP-FPM
#!/usr/bin/env bash
ZRAY_URL="http://repos.zend.com/zend-server/early-access/zray-tech-preview/zray-php-102775-php5.6.15-linux-debian7-amd64.tar.gz"
ZRAY_ARCHIVE_NAME="zray.tar.gz"
ZRAY_PACKAGE_NAME="zray-php-102775-php5.6.15-linux-debian7-amd64"
# download zray
curl -o /tmp/${ZRAY_ARCHIVE_NAME} ${ZRAY_URL}
# extract zray archive
tar xvfz /tmp/${ZRAY_ARCHIVE_NAME} -C /tmp
@artemgordinskiy
artemgordinskiy / get-current-spotify-track-properties
Created May 17, 2015 06:11
Get current Spotify track's properties
tell application "Spotify"
get player state
get artist of current track
get name of current track
get duration of current track
get popularity of current track
get track number of current track
get spotify url of current track
end tell