Skip to content

Instantly share code, notes, and snippets.

View pyk's full-sized avatar
🐈‍⬛
I may be slow to respond.

pyk pyk

🐈‍⬛
I may be slow to respond.
View GitHub Profile
@pyk
pyk / UniswapV3Preview.sol
Created March 26, 2022 00:01
Uniswap V3 getAmountsIn getAmountsOut via Flash Swap
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;
import "lib/ds-test/src/test.sol";
import { IERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import { gohm, usdc, weth, uniswapV2Router } from "chain/Tokens.sol";
import { IUniswapV2Router02 } from "../../interfaces/IUniswapV2Router02.sol";
@pyk
pyk / 1-setup.md
Created January 3, 2024 13:31 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS

Methods of Signing with a GPG Key on MacOS

Last updated September 21, 2022

This Gist explains how to do this using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

There has been a number of comments on this gist regarding some issues around the pinentry-program and M1 Macs. I've finally gotten a chance to try things out on an M1 and I've updated the documentation in 2-using-gpg.md to reflect my findings.

apiVersion: apps/v1
kind: StatefulSet
metadata:
name: elasticsearch
labels:
service: elasticsearch
spec:
serviceName: es
# NOTE: This is number of nodes that we want to run
# you may update this
@pyk
pyk / graceful_shutdown_while_loop.py
Created January 19, 2018 17:27
Graceful shutdown in Python While Loop
import time
import signal
def busy_work(seconds):
print("Start busy_work")
time.sleep(seconds)
print("Stop busy_work")
@pyk
pyk / timescaledb.md
Created March 9, 2023 01:10
Install timescaledb on debian docker image
# Install TimescaleDB
RUN apt update \
    && apt install -y gnupg postgresql-common apt-transport-https lsb-release wget \
    && /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y \
    && echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | tee /etc/apt/sources.list.d/timescaledb.list \
    && wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add - \
    && apt update \
    && apt install timescaledb-2-postgresql-15 -y
Function Set-Window {
<#
.SYNOPSIS
Retrieve/Set the window size and coordinates of a process window.
.DESCRIPTION
Retrieve/Set the size (height,width) and coordinates (x,y)
of a process window.
.PARAMETER ProcessName
{
"editor.fontSize": 14,
"workbench.colorTheme": "Visual Studio Light",
"workbench.colorCustomizations": {
"[DuoTone Dark Sea]": {
"sideBar.background": "#1D262F",
"sideBar.foreground": "#bec9d3",
"sideBar.dropBackground": "#bec9d3",
"sideBarTitle.foreground": "#444c55",
"sideBarSectionHeader.background": "#1D262F",
@pyk
pyk / biggestandsmallest.go
Created April 12, 2014 04:52
find the biggest and smallest number in the given slice or array using go lang
package main
import "fmt"
func main() {
var n, smallest, biggest int
x := []int{
48,96,86,68,
57,82,63,70,
37,34,83,27,
@pyk
pyk / tmux-cheatsheet.markdown
Created April 10, 2022 19:08 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;
pragma experimental ABIEncoderV2;
import "lib/ds-test/src/test.sol";
import { IERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import { IUniswapAdapter } from "../../interfaces/IUniswapAdapter.sol";