Skip to content

Instantly share code, notes, and snippets.

View preytaren's full-sized avatar
🍊
Focusing

preyta preytaren

🍊
Focusing
View GitHub Profile
@preytaren
preytaren / future.go
Last active March 22, 2021 10:44
Future Pattern in Go
package cacheutils
import (
"sync"
"time"
)
const FUTURETIMEOUT = 5 * time.Second
type Future interface {
@preytaren
preytaren / array_flag.go
Last active November 23, 2018 03:06
Read flag string like "a, b, c" to [a, b, c]
// used for parsing slice from flag input string
// read flag string like "a, b, c" and output [a, b, c]
package main
import (
"fmt"
"strings"
"flag"
)
@preytaren
preytaren / cleanup.py
Last active July 25, 2017 16:30
Helps you cleanup files in a specified folder, especially downloads. Re-group files in folders named by date it's created.
# -*- encoding= utf-8
“”“
“””
import os
import sys
import re
import shutil
import time
from collections import defaultdict