This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
WORKING: | |
- runs shadowsocks and http proxy clients | |
- redirects all traffic to ss-redir (port 1080) using iptables | |
- exposes local socks5 (port 1081) and http server (port 8118) | |
WIP: | |
- tor layer is still work in progress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v -0.000581696 -0.734665 -0.623267 | |
v 0.000283538 -1 0.286843 | |
v -0.117277 -0.973564 0.306907 | |
v -0.382144 -0.890788 0.221243 | |
v -0.247144 -0.942602 0.276051 | |
v -0.656078 -0.718512 -0.109025 | |
v -0.609847 -0.786562 0.0198068 | |
v -0.66248 -0.632053 -0.244271 | |
v -0.511812 -0.845392 0.127809 | |
v -0.609326 -0.569868 -0.41571 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install nix (5.5 mins) | |
curl https://nixos.org/nix/install | sh | |
# open a new shell to source nix | |
bash | |
# query available haskell compilers | |
nix-env -qaP -A nixpkgs.haskell.compiler [QUERY] | |
# install ghc (2.5 mins, cached binary) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class BulkUpsertManager(models.Manager): | |
@staticmethod | |
def __filter_field(field): | |
return not field.many_to_many | |
@staticmethod | |
def __to_serialized(field): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from django.contrib.gis.db.backends.postgis.base import \ | |
DatabaseWrapper as PostgisDBWrapper | |
from django.db import ProgrammingError | |
from .schema import TimescaleSchemaEditor | |
logger = logging.getLogger(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Register a callback to trigger when we detect a click outside of refs. | |
*/ | |
export function useDetectClickOutside(refs, callback) { | |
useEffect(() => { | |
const handleMouseDown = (e) => { | |
const clickOutsideOfRefs = | |
refs.every((r) => r.current) && | |
refs.every((r) => !r.current.contains(e.target)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ZoomableView<Content: View>: UIViewControllerRepresentable { | |
let gestures: [ZoomableViewGestureType] | |
@ViewBuilder let content: () -> Content | |
func makeUIViewController(context: Context) -> ZoomableViewController<Content> { | |
let vc = ZoomableViewController<Content>() | |
vc.gestures = gestures | |
vc.child = UIHostingController(rootView: content()) | |
return vc |