This file contains 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
- (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); |
This file contains 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
#!/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 |
This file contains 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
# ParallelBatch.py | |
# | |
# Created by Mads Ynddal on 15/07/15. | |
# 2015 Printix.net | |
# | |
from multiprocessing.pool import ThreadPool | |
class batch: | |
processes = 4 |
This file contains 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
#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. |
This file contains 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
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 |
This file contains 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
private struct Context | |
{ | |
public string val; | |
public ManualResetEvent doneEvent; | |
} | |
private void FunctionOnContext(object context){ | |
Context c = (Context)context; | |
lock (resultList) { |
This file contains 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
#!/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 "" |
This file contains 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 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 |
This file contains 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/python | |
import smtplib | |
import imaplib | |
import time | |
import random | |
import string | |
def send_mail(smtp_server, SSL, username, password, receiver, subject, body): | |
to = [receiver] |