Skip to content

Instantly share code, notes, and snippets.

View cfr's full-sized avatar
💭
👾

Stan Serebryakov cfr

💭
👾
View GitHub Profile
@cfr
cfr / config.zig
Last active December 3, 2023 18:27
pub const EntityType = enum { variable, array, object };
pub const Variable = struct { name: []const u8, value: []const u8 };
pub const Array = struct { name: []const u8, content: []const Variable };
pub const Object = struct { name: []const u8, fields: []const Variable };
pub const Entity = union(EntityType) { variable: Variable, array: Array, Object: Object };
@cfr
cfr / db-upload-chunk-backup.py
Created October 25, 2017 11:31
Script to backup large file to dropbox
#!/usr/bin/env python
import dropbox
import os
import time
file_path = "/opt/backups/backup.tar.gz"
dest_path = "/Apps/backup/"
dbx = dropbox.Dropbox("<app-token>")
dest_today_path = dest_path + time.strftime("%Y-%m-%d") + ".tgz"
# Just copy paste if you want more chests. The percentages for chests must add up to 100!
config:
enabled: true
modes:
chests: true
items: false
chests:
chest1:
items: 5*64;5*64;5*64;5*64;262*64;278*1;5*64%30
percentage: 5
{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
import Data.Text hiding (filter, unwords)
import Pipes
import Data.IORef
import Data.Maybe
import Data.Time (UTCTime(..), getCurrentTime)
import qualified Data.Map.Strict as M
// cfr.pw
#include "JG.h"
#include "DungeonGenerator.h"
ADungeonGenerator::ADungeonGenerator() {
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
RootComponent = CreateDefaultSubobject<USceneComponent>("SceneRoot");
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cfr
cfr / Completion.swift
Last active August 29, 2015 14:23
Completion type instead of (a → Void)
struct Completion<A> {
let f: (A -> Void)
init(f: A -> Void) {
self.f = f
}
func run(a: A) {
f(a)
}
}
@cfr
cfr / devert
Last active August 6, 2019 15:08
Fix vertical video
#!/usr/bin/env sh
# http://stackoverflow.com/a/30819570/187663
ffmpeg -i $1 -i $1 -filter_complex "[0:v]scale=-1:720[scaled_video];[1:v]scale=1280:720,boxblur=16[blur_image];[blur_image][scaled_video]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[outv]" -c:v libx264 -aspect 1280/720 -map [outv] -map 0:a -c:a copy $1.fixed.mp4
// clang -std=c99 -O3 cpy-vs-cat.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <mach/mach_time.h>
const int e6 = 1000000;
#define repeat for(int j = 0; j < e6; j++)
void flush() { fflush(stdout); }