Skip to content

Instantly share code, notes, and snippets.

@ggarlic
ggarlic / extract files
Created January 11, 2013 03:33
extract files
#extract files
shopt -s extglob
extract() {
local c e i
(($#)) || return
for i; do
c=''
e=1
#!/bin/bash
while inotifywait -e moved_to ~/.mail/{gmail,work}/inbox/new/; do
notify-send -i /usr/share/icons/Humanity/status/48/dialog-info.svg "You've got a new mail.'"
aplay -q ~/.mybashscripts/mail.wav
done
#!/bin/bash
while inotifywait -e moved_to ~/.mail/{gmail,work}/inbox/new/; do
notify-send -i /usr/share/icons/Humanity/status/48/dialog-info.svg "You've got a new mail.'"
aplay -q ~/.mybashscripts/mail.wav
done
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import pyinotify
import mailbox
import pynotify
import os
import gtk
from email.header import decode_header
from os.path import expanduser
#include <iostream>
using namespace std;
void hannoi (int n, char A, char B, char C) {
if (n == 1) {
cout << "move one from " << A << " to " << C << endl;
}
else {
hannoi (n-1, A, C, B);
cout << "move one from " << A << " to " << C << endl;
@ggarlic
ggarlic / gist:11028662
Created April 18, 2014 07:07
async and sync method in twisted
import time
from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.internet import reactor
from twisted.web import server
from twisted.internet.protocol import ProcessProtocol
from twisted.internet.defer import Deferred
from calendar import calendar
#mkdir,cd into it
mkcd(){
mkdir -p "$*"
cd "$*"
}
From: Antonio Radici <antonio@debian.org>
Date: Sat, 19 Sep 2015 13:19:55 +0200
Subject: sidebar
When enabled, mutt will show a list of mailboxes with (new) message counts in a
separate column on the left side of the screen.
As this feature is still considered to be unstable, this patch is only applied
in the "mutt-patched" package.
# coding: utf-8
import math
def map_loop():
list(map(math.sin, range(20000000)))
def for_loop():
r = []
for i in range(20000000):
r.append(math.sin(i))
print "\nadding string variables\n"
a = "zhi"
b = "hu"
c = "yao"
d = "xxx"
print a+b+c+d
print "\nadding string literals\n"
print "zhi" + "hu" + "yao" + "xxx"