Skip to content

Instantly share code, notes, and snippets.

@anilpai
anilpai / rt_curr_arbitrage.py
Created June 5, 2024 21:47
Real Time Currency Arbitrage
import requests
from typing import Tuple, List
from math import log
currencies = ('PLN', 'EUR', 'USD', 'RUB', 'INR', 'MXN')
api_key = 'fe69bd3037f74f699cf2bf8070b44374'
def get_rates(currencies: Tuple[str, ...], api_key: str) -> List[List[float]]:
rates = []
response = requests.get(f'https://openexchangerates.org/api/latest.json?app_id={api_key}')
@mcnesium
mcnesium / gnu_getopt_example.sh
Last active July 4, 2025 04:27 — forked from bobpaul/gnu_getopt_example.sh
An example showing how to use getopt
#!/usr/bin/env bash
# Time-stamp: <2017-04-27 09:57:21 kmodi>
# Time-stamp: <2018-03-20 12:58:02 bobpaul>
# derived from kmodi's gist: https://gist.github.com/kaushalmodi/74e9875d5ab0a2bc1010447f1bee5d0a
#
# Example of using getopt to parse command line options
# http://stackoverflow.com/a/29754866/1219634 Limitation: All the options
# starting with - have to be listed in --options/--longoptions, else getopt will
# error out.
# The downside is that if you intend to use this as a wrapper to some other program,
@pkenil96
pkenil96 / Spring Framework & Spring Boot.md
Last active July 4, 2025 04:23
Notes on spring concepts

Spring Framework

Servlets - Java technology that you use to handle incoming requests on a server. Its a java object that has special methods for handling incoming HTTP methods. doGet, doPost, doDelete, doPut

Spring Framework

Concepts:

  1. IOC Containers
  2. Dependency Injection
@dclark
dclark / aws-cloud-shell-get-aws-credentials.sh
Created August 25, 2023 11:37
AWS CloudShell get credentials
#!/usr/bin/env bash
# Retrieve AWS credentials from AWS CloudShell
# shellcheck disable=SC2001
HOST=$(echo "$AWS_CONTAINER_CREDENTIALS_FULL_URI" | sed 's|/latest.*||')
TOKEN=$(curl -s -X PUT "$HOST"/latest/api/token -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
OUTPUT=$(curl -s "$HOST/latest/meta-data/container/security-credentials" -H "X-aws-ec2-metadata-token: $TOKEN")
echo "export AWS_ACCESS_KEY_ID=$(echo "$OUTPUT" | jq -r '.AccessKeyId')"
echo "export AWS_SECRET_ACCESS_KEY=$(echo "$OUTPUT" | jq -r '.SecretAccessKey')"
@tourist
tourist / mmr_workout_gpx_export.py
Last active July 4, 2025 04:11
Exports workouts data from MapMyFitness API (MapMyRun and other MapMy* apps) to *.gpx file including timestamps. Might be used to import to another apps. MapMyFitness web interface offers export to *.gpx but without timestamps. Originaly used to move my data to Endomondo.
# quick & dirty export of workouts to *.gpx file with timestamps from MapMyFitness API
# for purpose of moving to other apps (tested with Endomondo)
# based on: https://developer.mapmyapi.com/docs/read/Authentication2
# needs API access request "Request a key" @ https://developer.mapmyapi.com/
from __future__ import unicode_literals
import requests
import urlparse
import webbrowser
import json
from requests_oauthlib import OAuth2
@j40903272
j40903272 / vllm_cu11.8
Created April 26, 2024 05:25
# Install vLLM with CUDA 11.8.
conda create -n vllm python=3.10
conda activate vllm
export VLLM_VERSION=0.4.0
export PYTHON_VERSION=310
pip install https://github.com/vllm-project/vllm/releases/download/v${VLLM_VERSION}/vllm-${VLLM_VERSION}+cu118-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}-manylinux1_x86_64.whl
# Re-install PyTorch with CUDA 11.8.
pip uninstall torch -y
pip install torch==2.1.2+cu118 --index-url https://download.pytorch.org/whl/cu118
@leptos-null
leptos-null / swift-hook.md
Last active July 4, 2025 03:59
Hooking Swift functions

This article aims to describe how to hook Swift functions.

Thanks to help from @NightwindDev for discussion and testing.

Overall, the idea is simple: Write our own Swift code that will have the same calling convention as the target code, then get a pointer to our own code and the target code, and call MSHookFunction with these values.

Code

@Braytiner
Braytiner / Windows Defender Exclusions VS 2022.ps1
Last active July 4, 2025 03:51
Adds Windows Defender exclusions for Visual Studio 2022
$userPath = $env:USERPROFILE
$pathExclusions = New-Object System.Collections.ArrayList
$processExclusions = New-Object System.Collections.ArrayList
$pathExclusions.Add('C:\Windows\Microsoft.NET') > $null
$pathExclusions.Add('C:\Windows\assembly') > $null
$pathExclusions.Add($userPath + '\Downloads\HeidiSQL_11.3_64_Portable') > $null
$pathExclusions.Add($userPath + '\.dotnet') > $null
@n1snt
n1snt / Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md
Last active July 4, 2025 03:25
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@h3ssan
h3ssan / JetBrains trial reset.md
Last active July 4, 2025 03:21
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these