Skip to content

Instantly share code, notes, and snippets.

@shapeshed
shapeshed / nginx_rails_3_1
Created October 10, 2011 19:13
Nginx Config for Rails 3.1 with Unicorn and Asset Pipeline
upstream app {
server unix:/srv/app/current/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name www.app.com;
rewrite ^/(.*) http://app.com/$1 permanent;
}
server {
@shapeshed
shapeshed / tmux settings
Last active March 5, 2025 11:42
tmux cricket status bar
set-option -g status on
set-option -g status-left-length 80
set-option -g status-interval 2
set-option -g status-left '#(curl -k -L -s http://www.cricinfo.com/ci/engine/match/1031661.html | pup "title text{}" | cut -d "|" -f 1)'
@shapeshed
shapeshed / reset.sh
Created July 31, 2024 08:05
Reset validator state
#!/bin/sh
# Configuration
SNAPSHOT_URL=https://osmosis.fra1.cdn.digitaloceanspaces.com/osmosis-1/snapshots/v25/osmosis-snapshot-202407310709-18675339.tar.lz4
OSMOSIS_HOME=$HOME/.osmosisd
COSMOVISOR_SERVICE=cosmovisor
# Stop the Cosmovisor service
sudo systemctl stop $COSMOVISOR_SERVICE
if [ $? -ne 0 ]; then
@shapeshed
shapeshed / twit_twurl.sh
Created June 4, 2010 12:21
Tweet from the command line using twurl & OAuth
################################
#!/usr/bin/env bash
# File: twit_twurl.sh
# Description: Tweet from the command line using twurl & OAuth
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@shapeshed
shapeshed / claimable_spreads.rs
Last active May 9, 2024 16:42
no claimable_spread_rewards / test-tube
// Setup
pub const TICK_SPACING: u64 = 100;
pub const SPREAD_FACTOR: &str = "1";
pub const BASE_DENOM: &str = "uosmo";
pub const QUOTE_DENOM: &str = "usdc";
gov.propose_and_execute(
CreateConcentratedLiquidityPoolsProposal::TYPE_URL.to_string(),
CreateConcentratedLiquidityPoolsProposal {
title: "Create concentrated uosmo:usdc pool".to_string(),
#!/usr/bin/env sh
#
# A script to test
# * the creation of a CW20 contract
# * the creation of a CW4 contract
# * the staking of CW20 tokens in the CW4 contract
CW20_CONTRACT_NAME=cw20_base.wasm
CW20_CONTRACT_URL=https://github.com/CosmWasm/cw-plus/releases/download/v0.13.4/cw20_base.wasm
CW4_CONTRACT_NAME=cw4_stake.wasm
wasm.execute(
&vault_address,
&deposit_msg,
&[Coin {
amount: deposit_amount,
denom: base_token.to_string(),
}],
&signer,
)
.unwrap();
@shapeshed
shapeshed / aws-cf-logs
Last active September 12, 2022 09:10
Fetch AWS Cloudfront Logs, decompress, combine into a single file and remove comments
#!/usr/bin/env bash
BUCKET=$1
CWD=$(pwd)
if [[ -n $1 ]]; then
aws s3 sync s3://$BUCKET/cf-logs .
cat *.gz > combined.log.gz
find $CWD ! -name 'combined.log.gz' -name '*.gz' -type f -exec rm -f {} +
gzip -d combined.log.gz
@shapeshed
shapeshed / gist:1016201
Created June 9, 2011 06:46
sshd_config
# Package generated configuration file
# See the sshd(8) manpage for details
# What ports, IPs and protocols we listen for
Port 7654
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
#!/usr/bin/env bash
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi