Skip to content

Instantly share code, notes, and snippets.

View danihodovic's full-sized avatar

Dani Hodovic danihodovic

View GitHub Profile
@D2theR
D2theR / README.md
Last active February 28, 2024 17:34
Auto-generates Serializers & ModelViewSets in a Django API using just models

Why?

I got sick of writing the same Serializer & ModelViewSet classes over and over so I found and wrote some code to do it for me, and somehow it works! Please note that there are a lot of caveats to running an API like this and while this may work, I know there's A LOT of room for improvement, feel free to fork and help!

USAGE

Import the router module to your main sites urls.py file as the injection point like so... Make sure to remove any other imports from other viewsets that you don't need that may conflict!

@nilayp
nilayp / upload_file_presigned_url.py
Last active June 5, 2024 03:07
Using presigned URLs with Backblaze B2 + AWS Python SDK
#! /usr/bin/env python
'''
Backblaze wants developers and organization to copy and re-use our
code examples, so we make the samples available by several different
licenses. One option is the MIT license (below). Other options are
available here:
https://www.backblaze.com/using_b2_code.html
The MIT License (MIT)
Copyright (c) 2021 Backblaze
@manning-ncsa
manning-ncsa / Readme.rst
Created April 18, 2021 17:59
Syncthing deployment on Kubernetes

Syncthing Device for a Persistent Peer

Overview

Syncthing provides a way to share arbitrary numbers of files between any number of people without the need for a central server. It is a peer-to-peer (P2P) application that automagically syncs files in the background. This deployment app launches a Syncthing "device" (Persistent Peer) that offers a high-availability peer for members of a team to include in their file shares.

For example, imagine there are three people in a team who want to share various folders with each other during the course of their work. They can accomplish this with Syncthing using only their three workstations, by exchanging Device IDs and sharing the folders. However, what if one person modifies or adds a file while the other two are offline, and then that person goes offline before the other two come online? In that event, they would not receive the update. This is where a Persistent Peer is helpful, because in

@jeanlucaslima
jeanlucaslima / Readme.md
Last active June 20, 2024 14:55
Remote Work Resources

Remote Jobs general guideline

This is something I compiled during the last weeks while job hunting. If you miss something in this list, please fork or tell me on twitter and I'll add what's missing.

  1. Be careful with jobs that are not clear they hire outside US
  2. Look for job in niches (like SaaS job boards, language-specific communities, country-focused, and so on)
  3. Avoid Upwork (pay to work, no guaranteed results, often bad contracts) and Remote.com
  4. Remote.co is not Remote.com, remote.co is ok.
  5. There are companies that hire and act as a guild, but only pay as freelancer (X-team, Gun.io, and so on)
  6. Not really focused on freelancing, as it is to me more like a one-person business
@superbrothers
superbrothers / kubectl-delete_all
Last active May 22, 2024 19:07
Kubernetes: Delete all objects in the namespace
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
@loicteixeira
loicteixeira / README.md
Last active August 23, 2019 14:50
[Wagtail] Create pages in migrations

Unfortunately because models returned by apps.get_model in migrations aren't the actual class, methods like Page.add aren't available and we have to do it manually. The most sensitive part being the handling of the path.

As an aside, deleting pages in migration will not update the numchild of the parent page. Unfortunately, the fixtree command doesn't play nice within a migration so it will need to be ran separately (or the parent page should manually be updated).

Notes: When not within a migration, a page path could be created with parent_page.get_last_child()._inc_path() or Page._get_children_path_interval(parent_page.path)[1].

@ekreutz
ekreutz / ansible_variable_precedence.md
Last active April 25, 2024 17:43
Ansible variable precedence (order, hierarchy)
@dohq
dohq / fzf-ssh.zsh
Last active March 21, 2024 14:44
fzf-ssh
function fzf-ssh () {
local selected_host=$(grep "Host " ~/.ssh/ssh_config | grep -v '*' | cut -b 6- | fzf --query "$LBUFFER" --prompt="SSH Remote > ")
if [ -n "$selected_host" ]; then
BUFFER="ssh ${selected_host}"
zle accept-line
fi
zle reset-prompt
}
@libitte
libitte / gist:cbde168d26bc5faf9bf9fef648091b42
Last active November 11, 2022 19:30
FIX warning: ignoring broken ref refs/remotes/origin/HEAD

warning: ignoring broken ref refs/remotes/origin/HEAD


➜   ✗ g symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/develop
➜   ✗ g fetch --prune
➜   ✗ g gc

@marians
marians / main.go
Created January 27, 2017 10:25
OAuth 2.0 authentication in a Golang CLI
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
"net/http"
"net/url"
"time"