Skip to content

Instantly share code, notes, and snippets.

View zfedoran's full-sized avatar

zfedoran

View GitHub Profile
@zfedoran
zfedoran / solana-security.md
Last active April 16, 2025 19:56
Solana Program Vulnerabilities Guide

Solana Program Vulnerabilities Guide

This guide outlines common vulnerabilities in Solana programs, focusing on Rust and Anchor-specific issues. Each vulnerability includes a description, insecure code patterns to detect, and mitigation strategies to enforce. Intended for intermediate to advanced developers familiar with Solana’s programming model.

1. Account Data Matching

Description: Failure to validate that an account’s data matches expected values, allowing malicious accounts to be processed.

Insecure Pattern:

pub fn update_admin_settings(ctx: Context, new_settings: AdminSettings) -> Result<()> {
@zfedoran
zfedoran / solana_beach_22.lua
Created February 8, 2025 18:02
Solana-Beach 22 Vim
-- Theme: Solana Beach 22
-- File: lua/themes/solana_beach_22.lua
-- Based on: https://marketplace.visualstudio.com/items?itemName=zfedoran.solanabeach-vscode
-- Use with ghostty custom-shader:
-- https://gist.github.com/zfedoran/4e8c2c172f3a8f381e2a92acdc894002
local M = {}
M.type = "dark"
@zfedoran
zfedoran / ghostty-glow.glsl
Created February 8, 2025 17:46
ghostty glow effect
// A set of sample offsets (x, y) and corresponding weights
const vec3[24] samples = vec3[](
vec3( 0.16937617, 0.98555148, 1.0),
vec3(-1.33307083, 0.47214633, 0.70710678),
vec3(-0.84643949, -1.51113871, 0.57735027),
vec3( 1.55415568, -1.25880901, 0.5),
vec3( 1.68136438, 1.47411459, 0.44721360),
vec3(-1.27951577, 2.08874110, 0.40824829),
vec3(-2.45758475, -0.97993734, 0.37796447),
vec3( 0.58746414, -2.76674644, 0.35355339),
@zfedoran
zfedoran / urls.js
Last active April 20, 2021 10:55
Basic URL handler with query param support
// Example urls.js file for a Vue or React project
// -------------------------------------------------------------------------------------
// URLs.js
// -------------------------------------------------------------------------------------
/*
* Get the url query parameters from the current URL in the address bar
*/
function get_url_params() {
@zfedoran
zfedoran / tflearn-example-sine-function.py
Created June 29, 2017 21:44
Basic DNN Example: Approximate sine function using tflearn
import tflearn
import numpy as np
import matplotlib.pyplot as plt
N = 1000
# Approximate sine function using tflearn
x = np.linspace(-np.pi, np.pi, N)
y = np.sin(x) + np.random.uniform(-0.5,0.5, N)
@zfedoran
zfedoran / simple-vuejs-example.html
Created May 2, 2016 18:24
Simple Vue.js Example (no build tools)
<!-- Live Example: https://jsfiddle.net/Lqn6ocqm/ -->
<component>
<style>
.zelimir div {
background: #0ff;
}
</style>
<template>
@zfedoran
zfedoran / vu.js
Last active March 31, 2017 20:42
Vu.js - Tiny Front-end Framework
// Vu.js v0.9000.1 Library
/* (Please don't use this, created as a joke) */
/* Live Example: https://jsfiddle.net/ya76bu7b/3/ */
class Vu {
constructor(config) {
this.$el = document.querySelector(config.el);
set nocompatible
"install pathogen
"git clone nerdtree, auto-pairs
call pathogen#infect()
syntax on
"set nu
set ts=2
@zfedoran
zfedoran / gist:2356736
Created April 11, 2012 03:55
[vim] skip over closing parenthesis with tab button
inoremap <expr> <Tab> SkipClosingParentheses()
function! SkipClosingParentheses()
let line = getline('.')
let current_char = line[col('.')-1]
"Ignore EOL
if col('.') == col('$')
return "\t"
end