Skip to content

Instantly share code, notes, and snippets.

Avatar

Endre Simo esimov

View GitHub Profile
@ityonemo
ityonemo / test.md
Last active Jun 12, 2021
Zig in 30 minutes
View test.md

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@esimov
esimov / factorial.go
Last active Apr 24, 2019
Factorial calculation in Go lang using three different methods: first traditionally, second with closure and third using memoization. The last method is the fastest between the three.
View factorial.go
package main
import (
"fmt"
"time"
)
const LIM = 41
var facts [LIM]uint64
@jeffcogswell
jeffcogswell / q_example.js
Last active Mar 1, 2021
Here's another chaining example on using q.js. This doesn't have any error handling, as I just want to demonstrate the chaining concept. Please read the comments carefully, as I start out with a non-q example, to show the order of flow. Please post comments if there's anything that isn't clear and I'll try to revise it as needed.
View q_example.js
// Q sample by Jeff Cogswell
/*===========
We want to call these three functions in sequence, one after the other:
First we want to call one, which initiates an ajax call. Once that
ajax call is complete, we want to call two. Once two's ajax call is
complete, we want to call three.
BUT, we don't want to just call our three functions in sequence, as this quick
@esimov
esimov / sublime_sass_to_css.json
Last active Oct 11, 2015
Sublime build for SASS->CSS automatic conversion
View sublime_sass_to_css.json
{
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css"],
"selector": "source.sass",
"line_regex": "Line ([0-9]+):",
"osx":
{
"path": "/usr/local/bin:$PATH"
},
@esimov
esimov / sublime_haml_to_html.json
Last active Mar 4, 2017
Sublime build for HAML->HTML automatic conversion
View sublime_haml_to_html.json
{
"cmd": ["haml"],
"working_dir": "${file_path:${folder}}",
"selector": "source.haml",
"file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
"windows":
{
"cmd": ["haml", "--trace", "$file", "${file_base_name}.html"],
"shell": "true"
@desandro
desandro / halftone-cartesian.pde
Last active Jun 10, 2021
Half-ton halftones Processing sketch
View halftone-cartesian.pde
// options
String imagePath = "img/desandro-avatar.jpg";
float res = 10; // resolution, dot density
float zoom = 3.0; // proportion to zoom image
boolean isAdditive = true; // true = RGB, false = CMY
float offsetAngle = 1; // affects dot pattern
/*
0 = no patter
0.05 = slight offset
1 = slight offset