Skip to content

Instantly share code, notes, and snippets.

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 /
Created Jun 5, 2021
Check FlowCrypt repos for outdated versions of GitHub Action
import requests
def has_new_gh_action(repo):
raw_url = f'{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 /
Created May 31, 2021
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:
seisvelas /
Last active May 8, 2021
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 /
Created Apr 22, 2021
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 /
Last active Mar 28, 2021
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 / gistblog->
Last active Mar 28, 2021
RSS feed of blog post Gists
View gistblog->
use reqwest::header::USER_AGENT;
use reqwest::header::CONTENT_TYPE;
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let res: Vec<serde_json::Value> = client
.header(USER_AGENT, "Xandre's RSS")
.header(CONTENT_TYPE, "application/rss+xml")
seisvelas / groupByChipset.js
Last active Mar 2, 2021
Group by chipset object problem
View groupByChipset.js
//Given an array of VIZIO TV models, create a "groupByChipset" function
//that aggregates the model names by their "chipset" field:
//Example input:
const tvs = [
"modelName": "VIZIO D24f-F1",
"chipset": "5581"
"modelName": "VIZIO V405-H9",
seisvelas /
Created Feb 21, 2021
Create pie chart from Clockify
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from sys import argv
def load_tasks(dataframe):
del dataframe['Project']
del dataframe['Client']
seisvelas /
Created Feb 2, 2021
Solution to cassidoo newsletter stock thing
def stockQueue(snapshot):
dequeued_snapshot = {
stock['sym']:stock['cost'] for stock in snapshot
return [
'cost': cost
} for stock, cost in dequeued_snapshot.items()
seisvelas /
Created Jan 18, 2021
Move and slice Godot script for Pancho
extends KinematicBody2D
var motion = Vector2()
func _physics_process(_delta):
motion.y += 10
if Input.is_action_pressed("ui_right"):
motion.x = 200
elif Input.is_action_pressed("ui_left"):