View mailalive.py
#!/usr/bin/python | |
import smtplib | |
import imaplib | |
import time | |
import random | |
import string | |
def send_mail(smtp_server, SSL, username, password, receiver, subject, body): | |
to = [receiver] |
View find_devices.py
import subprocess | |
import sys | |
import time | |
des = sys.argv[1] | |
def call(cmd): | |
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
# wait for the process to terminate |
View pdf.sh
#!/bin/bash | |
# TEXNAME='${echo $1 | egrep -o "^([^.]*)"}' | |
TEXNAME=$(echo $1 | egrep -wo "^([^.]*)") # Strip up to first extension | |
echo $TEXNAME | |
cd $(dirname "$TEXNAME") | |
PATH=/usr/local/texlive/2014/bin/x86_64-darwin:$PATH | |
pdflatex -interaction=batchmode "$TEXNAME.tex" | |
echo "" |
View ThreadPoolTemplate.cs
private struct Context | |
{ | |
public string val; | |
public ManualResetEvent doneEvent; | |
} | |
private void FunctionOnContext(object context){ | |
Context c = (Context)context; | |
lock (resultList) { |
View gist:487b07570502332182091bc8c5d9235c
iTerm: | |
Trigger regex: ^([a-zA-Z0-9+/.-]+):([0-9]+):([0-9]+): ([0-9]+):[0-9]+ (?:error): | |
Trigger action: Capture Output | |
Trigger parameter: echo ":call GetTabOrOpenFile(\"\1\")"; echo "$[\2 - 1]G\3|" | |
For .vimrc: | |
set swb=usetab | |
function! GetTabOrOpenFile(file) | |
try | |
execute "tab sb ".a:file |
View Configuration.h
#ifndef CONFIGURATION_H | |
#define CONFIGURATION_H | |
// This configurtion file contains the basic settings. | |
// Advanced settings can be found in Configuration_adv.h | |
// BASIC SETTINGS: select your board type, temperature sensor type, axis scaling, and endstop configuration | |
//User specified version info of this build to display in [Pronterface, etc] terminal window during startup. | |
//Implementation of an idea by Prof Braino to inform user that any changes made | |
//to this build by the user have been successfully uploaded into firmware. |
View ParallelBatch.py
# ParallelBatch.py | |
# | |
# Created by Mads Ynddal on 15/07/15. | |
# 2015 Printix.net | |
# | |
from multiprocessing.pool import ThreadPool | |
class batch: | |
processes = 4 |
View gist:7b1b9a0d0b9c4ce7d751
#!/bin/sh | |
# Original script: https://gist.github.com/Wysie/7487571 | |
# | |
# Script to route traffic from home network through VPN selectively. | |
# Based off the discussion at http://www.smallnetbuilder.com/forums/showthread.php?t=9311 | |
# The setup is a Macbook, Apple Tv and a Raspberry Pi. | |
# The aim is to have all traffic from those 3 go through the VPN, all traffic from all other devices should bypassing the VPN. | |
# | |
# Requirements: Asuswrt-Merlin with OpenVPN already set up |
View Run Async Method and run method afterwards
- (void) someMethod{ | |
[self dispatchBlockAsync:^{ | |
[self method1]; | |
} callOnReturn:^{ | |
[self method2];] | |
}]; | |
} | |
- (void)dispatchBlockAsync:(void(^)(void))callBlock callOnReturn:(void(^)(void))returnBlock{ | |
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); |