Skip to content

Instantly share code, notes, and snippets.

View seisvelas's full-sized avatar
🦊
const sh = network.pop(shell); sh.write({recipient:'admin'}, 'nice system!');

Xandre V seisvelas

🦊
const sh = network.pop(shell); sh.write({recipient:'admin'}, 'nice system!');
View GitHub Profile
@seisvelas
seisvelas / nqueens_sql.md
Last active October 15, 2023 08:03
Solving n queens in SQL

8 queens (wiki explanation), as well as its variant n queens, was one of the first really 'hard' toy problems I did at Hola<Code /> (Hi people who look down at bootcamp alumni. I understand you. But still go fuck yourself). First I did it in Python with backtracking and a global store of solutions. Then I did it statelessly in Racket, then in Javascript, then back around to Python. here is my Node.js version (stateless):

var {range} = require('range')
        
function isThreatened(board, pos) {
  return board.includes(pos) ||
@seisvelas
seisvelas / emails_updated.py
Created June 5, 2021 21:49
Check FlowCrypt repos for outdated versions of GitHub Action
import requests
def has_new_gh_action(repo):
raw_url = f'https://raw.githubusercontent.com/FlowCrypt/{repo}/master/.github/workflows/check-for-emails.yml'
raw_action_request = requests.get(raw_url)
if raw_action_request.status_code != 200:
print(f'error checking repo {repo}, status code {raw_action_request.status_code}')
return False
return 'exemptions' in raw_action_request.text
@seisvelas
seisvelas / cp.py
Created May 31, 2021 04:49
Teaching Fatima fundamental file operations in Python
# Simple version of cp command
import sys
if len(sys.argv) < 3:
raise Exception('too few arguments')
command, source, destination, *rest = sys.argv
with open(source, 'rb') as source_file:

I'm Xandre, a security engineer. Code to me is like a vast ocean, and I want to reach the sea floor and map it all out.


I love finding security bugs in open source software.

This blog isn't static - it uses GitHub Gists as a backend. I've made an NPM package in case you also want a more convenient way to host a blog on GitHub Pages: https://www.npmjs.com/package/@xandrev/gistblog

To learn more about my work, check out my portfolio

@seisvelas
seisvelas / secure_algs.py
Last active May 8, 2021 10:14
ugly Python one-liner
python3 -c 'with open("secure_sigalgs") as f: print("jdk.tls.server.SignatureSchemes=" + ",".join([i.rstrip() for i in f.readlines()]))'
@seisvelas
seisvelas / fmnist.rs
Created April 22, 2021 06:19
Acquire Fashion MNIST and verify that images + labels work
extern crate cifar_10_loader;
extern crate image;
use cifar_10_loader::CifarDataset;
use std::fs::File;
use std::collections::HashMap;
fn main() {
let mut label_ids = HashMap::new();
label_ids.insert(0, "airplane");
@seisvelas
seisvelas / sieve.js
Last active April 2, 2021 03:28
Sieve of Eratosthenes: Lisp vs JavaScript
const { range } = require('range');
const sieve = (field) =>
// initialize
(typeof field === 'number')
? sieve(range(2, field))
// recursive case
: (field.length)
? [field[0]].concat(
@seisvelas
seisvelas / salesforce_tables.md
Last active March 29, 2021 21:12
Why do Salesforce SQL tables end with __c?

En el trabajo hoy estoy haciendo un VIEW de unas tablas de Salesforce. Como nunca había usado Salesforce, me sorprendió que las tablas acabaron con __c, y no entendí porque pasa eso, así que pregunté a mi jefe. El mi respondió que es una cosa que hace Salesforce por alguna razón. Juj. Pues eso lo vi bien raro, entonces me puse a buscar 'Por que las tablas de Salesforce acaban con __c, cual búsqueda me condujo a la siguiente pregunta en StackOverflow:

https://salesforce.stackexchange.com/questions/101844/what-are-the-object-and-field-name-suffixes-that-salesforce-uses-such-as-c-an

Super interesante! No se necesita una entrada en el blog para este datito pero fue tan al azar, ¡no pude resistir! No me juzguen amigos, por favor. Lo triste/feliz es que la companía ya se ha movido de Salesforce. No tendré que usarlo, pero la verdad un parte de mi lo quise aprender bien. Salesforce es como so propio mundo de raridades.

@seisvelas
seisvelas / blog_rss_rust.md
Last active March 28, 2021 23:38
Building this blog's RSS feed in Rust

This is not a static blog. It dynamically loads all of my GitHub Gists that begin with blog_. This presented a challenge as to how I would implement RSS, considering I don't have a backend from which I can build the RSS feed, and I also can't statically generate the feed with each deploy, as a Jekyll blog might do.

Wut do? My boring compromise (for now!) is to make a simple Heroku app that calls the Gist API to grab the blog posts, just like this blog does. Except instead of actually rendering the Gists into a blog, I give an RSS feed!

This should be a pretty fun, byte-sized task. Which makes it perfect for a blog post!

Divying the task into little pieces

This project can be divided into the following tasks:

  1. Set up "Hello, world!" web app on Heroku
@seisvelas
seisvelas / gistblog->rss.rs
Last active March 28, 2021 12:14
RSS feed of blog post Gists
use reqwest::header::USER_AGENT;
use reqwest::header::CONTENT_TYPE;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let res: Vec<serde_json::Value> = client
.get("https://api.github.com/users/seisvelas/gists?page=1&per_page=100")
.header(USER_AGENT, "Xandre's RSS")
.header(CONTENT_TYPE, "application/rss+xml")