Skip to content

Instantly share code, notes, and snippets.

View jrosco's full-sized avatar
:shipit:
winning

Joel Cumberland jrosco

:shipit:
winning
View GitHub Profile
@jrosco
jrosco / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jrosco
jrosco / dbus_notify_popup
Last active August 29, 2015 14:13
DBus Notifcation Popup
#!/usr/bin/env python
import dbus
def notify(summary, body='', app_name='', app_icon='',
timeout=5000, actions=[], hints=[], replaces_id=0):
bus_name = 'org.freedesktop.Notifications'
object_path = '/org/freedesktop/Notifications'
interface_name = bus_name
@jrosco
jrosco / onchange.sh
Last active December 27, 2024 01:52 — forked from senko/onchange.sh
#!/bin/bash
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
@jrosco
jrosco / restart_py.py
Last active March 9, 2025 10:05
Restart running python program from inside app
#!/usr/bin/env python
import sys
import os
def restart_program():
"""Restarts the current program.
Note: this function does not return. Any cleanup action (like
saving data) must be done before calling this function."""
python = sys.executable
os.execl(python, python, * sys.argv)
@jrosco
jrosco / popup gtk.window
Last active December 4, 2017 00:20
Gtk icon popup gtk.window
#!/usr/bin/python
import gtk
class StatusIcon:
def __init__(self):
self.statusicon = gtk.StatusIcon()
@jrosco
jrosco / nadar.py
Last active August 29, 2015 14:14 — forked from emad-elsaid/nadar.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# prerequisites :
# sudo apt-get install nmap
#
# nmap.py
# Network Radar
#
#
# This program is free software; you can redistribute it and/or modify
def outsideFunc(Func):
def one(*args, **kwargs):
print Func(*args, **kwargs)
def two(*args, **kwargs):
print Func(*args, **kwargs)
def nothing(*args, **kwargs):
print Func(*args, **kwargs)
class SetterNGetter():
def __init__(self, *args, **kwargs):
self.my_age = kwargs['age']
self.my_name = kwargs['name']
@property
def my_age(self):
return self.my_age
class LogWrappedFunction(object):
def __init__(self, function):
self.function = function
def logAndCall(self, *arguments, **namedArguments):
print "Calling %s with arguments %s and named arguments %s" %\
(self.function.func_name, arguments, namedArguments)
self.function.__call__(*arguments, **namedArguments)
def logwrap(function):

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname