Skip to content

Instantly share code, notes, and snippets.

@endrsmar
endrsmar / index.ts
Created January 9, 2024 12:11
Raydium new pool listener
import { LiquidityPoolKeysV4, MARKET_STATE_LAYOUT_V3, Market, TOKEN_PROGRAM_ID } from "@raydium-io/raydium-sdk";
import { Connection, Logs, ParsedInnerInstruction, ParsedInstruction, ParsedTransactionWithMeta, PartiallyDecodedInstruction, PublicKey } from "@solana/web3.js";
const RPC_ENDPOINT = 'https://api.mainnet-beta.solana.com';
const RAYDIUM_POOL_V4_PROGRAM_ID = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8';
const SERUM_OPENBOOK_PROGRAM_ID = 'srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX';
const SOL_MINT = 'So11111111111111111111111111111111111111112';
const SOL_DECIMALS = 9;
const connection = new Connection(RPC_ENDPOINT);
@Karreg
Karreg / docker-cleanup.sh
Last active October 28, 2020 07:08
Script to cleanup Docker leftovers, related to https://github.com/moby/moby/issues/22207
#!/bin/bash
echo "WARN: This will remove everything from docker: volumes, containers and images. Will you dare? [y/N] "
read choice
if [ \( "$choice" == "y" \) -o \( "$choice" == "Y" \) ]
then
sudo echo "> sudo rights [OK]"
sizea=`sudo du -sh /var/lib/docker/aufs`
@marcofugaro
marcofugaro / README.md
Last active September 14, 2020 15:16
Paste this in the console of your github profile page and start drawing on your contributions!

Made to work along with gitfiti, you can draw with this tool and then export the data and use it with gitfiti.

##Usage

  1. Paste the code in the console of any github profile page which has the contributions graph
  2. Start drawing! Left click to increment the color, right click to clear the cell, clear button to clear everything! Dragging also works!
  3. Once you're happy you can export the data by typing ContributionsDraw.export() into the console.
  4. Or if you want you can also import existing data with ContributionsDraw.import([...])

NOTE: This is developed for and tested in Chrome, other browsers might not support yet some ES6 stuff, you might need to compile it to ES5.

@graceavery
graceavery / harryPotterAliases
Last active May 10, 2023 02:51
bash aliases for Harry Potter enthusiasts
alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv
alias sonorus='set -v'
alias quietus='set +v'
@cvan
cvan / HOWTO.md
Last active May 7, 2024 15:23
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@coolaj86
coolaj86 / github-pages-https-lets-encrypt.md
Last active November 16, 2021 22:36
Github Pages: Let's Encrypt!
@sharplet
sharplet / README.md
Last active June 8, 2018 22:10
Unearned Stack Overflow badges Dashing widget

Badge Overflow

An exceptionally handsome way to track your Stack Overflow badges.

Created by Adam & Stephanie Sharp.

Unearned Badges widget

A Dashing widget that tracks your progress toward unearned badges on Stack Overflow.

@schjetne
schjetne / back-with-fallback.js
Created April 24, 2013 12:12
Code to navigate to previous page in history if it exists, otherwise go back to a default "back" location.
// Use: ><a href="list.html" class="js-back">Go back</a>
$('.js-back').on('click', function(evt) {
if (document.referrer != "") {
evt.preventDefault();
history.back();
}
});
@oddnoc
oddnoc / MetadataExtension.php
Created March 27, 2013 19:46
A simple extension for SilverStripe 3.1 that restores the meta tag behavior of 3.0. Needs SiteTree::add_extension('MetadataExtension'); in your config.
class MetadataExtension extends DataExtension {
static $db = array(
'MetaTitle' => 'Varchar(255)',
'MetaKeywords' => 'Varchar(1024)',
);
function updateCMSFields(FieldList $fields) {
$metadata_field = $fields->fieldByName('Root.Main.Metadata');
$metatitle_field = new TextField('MetaTitle', $this->owner->fieldLabel('MetaTitle'));
@mathewbyrne
mathewbyrne / CsvResponse.php
Created March 21, 2013 22:54
A small Symfony 2 class for returning a response as a CSV file. Based on the Symfony JsonResponse class.
<?php
namespace Jb\AdminBundle\Http;
use Symfony\Component\HttpFoundation\Response;
class CsvResponse extends Response
{
protected $data;