Skip to content

Instantly share code, notes, and snippets.

@redraw
redraw / Y2038.c
Created September 26, 2018 15:01
#include<stdio.h>
#include<stdint.h>
#include<time.h>
#define Y2038 (int32_t)2147483647
int32_t ts;
void main() {
ts = (int32_t) time(NULL);
@redraw
redraw / genpass.py
Last active October 23, 2018 19:51
#!/usr/bin/env python3
import random
import string
import argparse
def generate_password(n, no_punctuation=False):
wordspace = string.ascii_letters
if not no_punctuation:
class AttrDict(dict):
def __getattr__(self, value):
if not value in dir(self) and value in self:
return self[value]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am redraw on github.
  • I am redraw (https://keybase.io/redraw) on keybase.
  • I have a public key ASBNs8j1l7dua8Dye7Rcn1OzXtVin78-0xTjAzAKeZANyQo

To claim this, I am signing this object:

#!/usr/bin/python3
import os
from gooey import GooeyParser, Gooey
from imagecluster import calc, io as icio, postproc
def run(args):
images, fingerprints, timestamps = icio.get_image_data(args.input)
clusters = calc.cluster(fingerprints, sim=0.5)
output_path = os.path.join(args.input, 'clusters')
@redraw
redraw / dotfiles.sh
Last active March 17, 2021 00:48
restore dotfiles script
#!/bin/bash
# clone repo
git clone --bare git@github.com:redraw/dotfiles.git $HOME/.dotfiles
dotfiles () { git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME "$@"; }
# backup
for file in $(dotfiles ls-tree --name-only HEAD); do
mv -vf $file $file.bak 2>/dev/null
done
@redraw
redraw / run.js
Created February 13, 2020 04:22
instagram-private-api login test
require('console-stamp')(console);
import {
IgApiClient,
IgCheckpointError,
IgLoginTwoFactorRequiredError,
IgResponseError
} from 'instagram-private-api'
import inquirer from 'inquirer'
@redraw
redraw / Dockerfile
Last active March 11, 2020 18:09
simple django + nginx + gunicorn docker-compose
FROM python:3
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.txt /code/
RUN pip install -r requirements.txt
COPY . /code/
{"hostname":"x556","server":"http://localhost:19999/","netdata_version":"v1.20.0-211-g721b72a2","snapshot_version":1,"after_ms":1584997876166.5,"before_ms":1584997908833.5,"highlight_after_ms":0,"highlight_before_ms":0,"duration_ms":32667,"update_every_ms":1000,"data_points":33,"url":"http://localhost:19999/","comments":"I can't find the root cause of these IO waits!","hash":"#menu_system_submenu_cpu","charts":{"hostname":"x556","version":"v1.20.0-211-g721b72a2","release_channel":"nightly","os":"linux","timezone":"America/Argentina/Buenos_Aires","update_every":1,"history":3996,"memory_mode":"dbengine","custom_info":"","charts":{"mem.transparent_hugepages":{"id":"mem.transparent_hugepages","name":"mem.transparent_hugepages","type":"mem","family":"hugepages","context":"mem.transparent_hugepages","title":"Transparent HugePages Memory (mem.transparent_hugepages)","priority":1250,"plugin":"proc.plugin","module":"/proc/meminfo","enabled":true,"units":"MiB","data_url":"/api/v1/data?chart=mem.transparent_hugepages","