Skip to content

Instantly share code, notes, and snippets.

View aleksandarristic's full-sized avatar

Aleksandar Ristic aleksandarristic

View GitHub Profile
@aleksandarristic
aleksandarristic / dloader.py
Last active May 3, 2020 10:25
termux dloader
#!/usr/bin/env python
import os
import sys
class Choice(object):
def __init__(self, config, message):
self.config = config
self.message = message
@aleksandarristic
aleksandarristic / netinfo.sh
Created August 5, 2015 14:22
Get network info from bash
ip -o -f inet addr show $(ip route list | awk '/^default/ {print $5}') | awk '{print $4}'

Keybase proof

I hereby claim:

  • I am aleksandarristic on github.
  • I am leka (https://keybase.io/leka) on keybase.
  • I have a public key whose fingerprint is 7865 6744 9481 D574 710F 8944 315E 25D0 3142 738C

To claim this, I am signing this object:

alias fucking='sudo'
alias fuck='sudo $(history -p \!\!)'
alias ohnoes='kill -9 $(pgrep -f $last)'
startup_message off
autodetach on
nonblock on
defscrollback 2048
termcapinfo xterm* ti@:te@
defutf8 on
#caption always "%{= wb}$USER @ %H >> %-Lw%{= r}%50>%n* %t%{-}%+Lw%< %-=<< (%c.%s)"
#hardstatus off
@aleksandarristic
aleksandarristic / cached_property_descriptor.py
Created September 6, 2013 10:13
A CachedProperty descriptor; It receives an expensive getter function (& optional arguments for it). The __get__ runs the getter function with the object instance as the first argument (& optional arguments provided in __init__) and caches the result. The __set__ just changes the cache to the 'value', __delete__ removes the cache.
class CachedProperty(object):
"""
A cached property; A bit specific, as
it runs the getter as an instance method
& forwards the instance & init args to it.
Uses python descriptors protocol
"""
def __init__(self, getter, *args):
self.getter = getter
self.args = args or None