Skip to content

Instantly share code, notes, and snippets.

Sidney San Martín s4y

Block or report user

Report or block s4y

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@s4y
s4y / raymarch_cube_slices.py
Created Sep 23, 2019
A ray marched cube (runs in Pythonista)
View raymarch_cube_slices.py
# coding: utf-8
import scene
import motion
preamble = """
precision highp float;
varying vec2 v_tex_coord;
uniform vec2 u_sprite_size;
uniform sampler2D u_texture;
View macvim-pull-858.rb
# Reference: https://github.com/macvim-dev/macvim/wiki/building
class Macvim < Formula
desc "GUI for vim, made for macOS"
homepage "https://github.com/macvim-dev/macvim"
head "https://github.com/s4y/macvim.git", :branch => "stateful-render"
depends_on :xcode => :build
depends_on "cscope"
depends_on "lua"
depends_on "python"
@s4y
s4y / unbak.py
Created Mar 7, 2019
Recover data from Apple backup files
View unbak.py
#!/usr/bin/env python3
# See https://www.downtowndougbrown.com/2013/06/legacy-apple-backup-file-format-on-floppy-disks/
import os
import pathlib
import struct
import sys
f = open(sys.argv[1], 'rb')
View mp4ify
#!/bin/bash
if [[ $# < 1 ]]; then
echo "usage: $0 input.mov [ffmpeg_opts]..." 1>&2
exit 1
fi
infile="$1"
shift
outfile="${infile%.*}.mp4"
@s4y
s4y / ac3_downmix.txt
Last active Jan 9, 2019
Convert mkv to mp4, downmix audio to stereo, keep original audio as second track
View ac3_downmix.txt
for f in *.mkv; do ffmpeg -hide_banner -y -i "$f" -c copy -c:s mov_text -map 0:v -map 0:a -map 0:a -map s -ac:a:0 2 -c:a:0 aac -disposition:a:0 none -disposition:a:1 default -movflags +faststart "${f%.mkv}.mp4" || break; done
@s4y
s4y / 4chan_archive.py
Created Nov 12, 2018
4chan thread archiver. Old project; not maintained.
View 4chan_archive.py
#!/usr/bin/env python3
from urllib.request import urlopen, urlretrieve
from urllib.error import HTTPError
import json
import os
import sys
import time
def update(thread):
View htba_gif.sh
youtube-dl -o htba VaL-KP6QOUI && (textargs='borderw=3:font=Arial Black:fontcolor=white:fontsize=40:x=40:y=h-lh-20' ; ffmpeg -ss 38 -t 2.85 -i htba.* -lavfi 'scale=502:-1 , drawtext='"$textargs"':enable=between(t\,1.5\,1.8):text=I , drawtext='"$textargs"':enable=between(t\,1.8\,2.1):text=I RESPECT , drawtext='"$textargs"':enable=gte(t\,2.1):text=I RESPECT WOMEN , split=3[mp4out][s1][s2] ; [s1]palettegen[p], [s2]fifo[s2], [s2][p]paletteuse[gifout]' -map '[mp4out]' -pix_fmt yuv420p -map 0:1 i_respect_women.mp4 -map '[gifout]' i_respect_women.gif)
View syspower.c
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
typedef struct {
char key[4];
char ignored[24];
uint32_t size;
char ignored2[10];
char cmd;
char ignored3[5];
View naive_utf8.c
#include <inttypes.h>
#include <stdlib.h>
typedef enum {
UTF8_OK = 0,
UTF8_ERROR = 4,
} utf8_decode_state_t;
typedef struct {
utf8_decode_state_t state;
View maybe_a_shell.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main() {
for (;;) {
char* line = NULL;
size_t cap;
ssize_t sz;
You can’t perform that action at this time.