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 | |
pgrep spotify 1>/dev/null 2>&1 | |
if [ $? != 0 ]; then | |
exit 1 | |
fi | |
xwininfo -root -tree | grep "Spotify -" | sed 's/[ ]*0x[0-9a-f]* "Spotify - \(.*\)": ("spotify" "Spotify").*/\1/' |
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
pi@raspberrypi:~/UnixBench$ ./Run | |
make all | |
make[1]: Entering directory `/home/pi/UnixBench' | |
Checking distribution of files | |
./pgms exists | |
./src exists | |
./testdir exists | |
./tmp exists | |
./results exists | |
make[1]: Leaving directory `/home/pi/UnixBench' |
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
#include <stdio.h> | |
int add(int a, int b) | |
{ | |
return a + b; | |
} | |
int addtimestwo(int (*fp)(int,int), int a, int b) | |
{ | |
return (*fp)(a, b) * 2; |
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
#include <xc.h> | |
#include <stdint.h> | |
#define _XTAL_FREQ 4000000 // required for __delay_ms() | |
#define DELAY 1000 | |
#define THRESHOLD 100 | |
#pragma config MCLRE=OFF, MCPU=OFF, CP=OFF, WDTE=OFF, IOSCFS=4MHZ | |
void |
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
pdfextract () | |
{ | |
if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] ; then | |
echo "Usage: pdfextract <source doc> <first page> <last page>." | |
else | |
OUTPDF=$1_p$2-$3.pdf | |
pdftops $1 - | psselect -p$2-$3 | ps2pdf14 - $OUTPDF | |
echo "Output saved as: $OUTPDF" | |
fi | |
} |
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
#include <stdio.h> | |
int | |
main (void) | |
{ | |
FILE *f; | |
char name[255]; | |
if( !(f = popen("uname -n", "r")) ){ | |
perror("Can't execute cmd"); |
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
#include <stdio.h> | |
#include <string.h> | |
int | |
main (void) { | |
char test_string[] = "machinename.local"; | |
char* result = NULL; | |
result = strtok(test_string, "."); |
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
/* | |
* Copyright (c) 2013 Erlang Solutions Ltd. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
CFLAGS=-Wall -pedantic | |
SRC=$(wildcard *.c) | |
OBJ=$(SRC:.c=.o) | |
BIN=$(SRC:.c=) | |
all: $(BIN) | |
clean: | |
$(RM) $(OBJ) $(BIN) |
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
using System; | |
using System.Management; | |
namespace WMIDeviceChangeDetect | |
{ | |
public class WMIDeviceChangeDetect | |
{ | |
private static void HandleEvent(object sender, EventArrivedEventArgs e) | |
{ |
OlderNewer