Skip to content

Instantly share code, notes, and snippets.

Stan Serebryakov cfr

Block or report user

Report or block cfr

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
@cfr
cfr / db-upload-chunk-backup.py
Created Oct 25, 2017
Script to backup large file to dropbox
View db-upload-chunk-backup.py
#!/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"
View chests.yml
# 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
View caddy.hs
{-# 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
View DungeonGenerator.cpp
// 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");
View f-ascii.stl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View f.stl
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 Aug 29, 2015
Completion type instead of (a → Void)
View Completion.swift
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 Apr 24, 2019
Fix vertical video
View devert
#!/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
View cpy-vs-cat.c
// 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); }
View Convertible.swift
protocol Convertible {
func to<T>() -> T;
// var <T>to: T { get } // multiple instances of generic var is not allowed
}
extension String {
func to() -> String {
return self
}
You can’t perform that action at this time.