snippets / slubman / 

All slubman's snippets (13)

  1. Port forwarding

    Manque à implémenter une façon d'arrêter le script !!

     1 #! /usr/bin/env python
    2 #-*- coding: utf-8 -*-
    3
    4 import socket
    5 import threading
    6
    7 class PipeThread(threading.Thread):
    8 pipes = []
    9 def __init__(self, sockInput, sockOutput, name):
    10 threading.Thread.__init__(self)
    11 self.setName(name)
    12 self.pipes.append(self)
    13 self.mydata = threading.local()
    14 self.sockInput = sockInput
    15 self.sockOutput = sockOutput
    16
    17 def run(self):
    18 print self.getName(), "started !!"
    19 while True:
    20 try:
    21 self.mydata.buffer = self.sockInput.recv(1024)
    22 if not self.mydata.buffer:
    23 break;
    24 print self.getName(), " :", self.mydata.buffer[0:48]
    25 self.sockOutput.send(self.mydata.buffer)
    26 except KeyboardInterrupt:
    27 sys.exit(0)
    28 except:
    29 break
    30 print self.getName(), "ended !!"
    31 self.sockInput.close()
    32 self.sockOutput.close()
    33 self.pipes.remove(self)
    34
    35
    36 class PipeHole(threading.Thread):
    37 def __init__(self, portInput, host, portOutput):
    38 threading.Thread.__init__(self)
    39 print "Redirecting : localhost:%s -> %s:%s" % (portInput, host, portOutput)
    40 self.hostname = hostname
    41 self.portOutput = portOutput
    42 # Wait for incomings clients
    43 self.sockMaster = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    44 self.sockMaster.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    45 self.sockMaster.bind(('', portInput))
    46 self.sockMaster.listen(5)
    47 print "Server is ready !!"
    48
    49 def run(self):
    50 try:
    51 while True:
    52 # Accept a client connection
    53 sockClient, addr = self.sockMaster.accept()
    54 sRemote = socket.gethostbyaddr(addr[0])
    55 print "Connection :", sRemote[0], sRemote[2] , ":", sockClient.getpeername()[1]
    56 # Connect to server
    57 sockServer = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    58 sockServer.connect((self.hostname, self.portOutput))
    59 PipeThread(sockClient, sockServer, "Client").start()
    60 PipeThread(sockServer, sockClient, "Server").start()
    61 except KeyboardInterrupt:
    62 sys.exit(0)
    63 self.sockMaster.close()
    64
    65 if __name__ == '__main__':
    66 import sys
    67 try:
    68 port = int(sys.argv[1])
    69 hostname = sys.argv[2]
    70 try:
    71 new_port = int(sys.argv[3])
    72 except IndexError:
    73 new_port = port
    74 except (IndexError, ValueError):
    75 print "Usage: %s port hostname [new_port]" % sys.argv[0]
    76 sys.exit(1)
    77
    78 try:
    79 mainThread = PipeHole(port, hostname, new_port)
    80 mainThread.start()
    81 mainThread.join()
    82 except KeyboardInterrupt:
    83 sys.exit(0)
    84
    85 print "Shutting down !!"
    86 #sys.exit(0)
    first posted by slubman to python server ... saved by 2 persons ... 0 comments ... 1 year, 1 month
  2. pkgsearch - Search archlinux pkgbuild

    pkgsearch list all packages that contain your string and display installed packages. pksearch -h for options

      1 #!/bin/bash
    2 #
    3 # pkgsearch
    4 #
    5 # Copyright (c) 2006 by Benoit Chesneau <benoit@bchesneau.info>
    6 #
    7 # This program is free software; you can redistribute it and/or modify
    8 # it under the terms of the GNU General Public License as published by
    9 # the Free Software Foundation; either version 2 of the License, or
    10 # (at your option) any later version.
    11 #
    12 # This program is distributed in the hope that it will be useful,
    13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    15 # GNU General Public License for more details.
    16 #
    17 # You should have received a copy of the GNU General Public License
    18 # along with this program; if not, write to the Free Software
    19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
    20 # USA.
    21 #
    22 # AUTHORS :
    23 # - Maintainer : Benoit Chesneau <benoitc@archlinuxfr.org>
    24 # - Contributor : slubman <slubman@archlinuxfr.org>
    25 # CHANGELOG :
    26 # - version 0.6
    27 # cosmethics changes
    28 # internal rewrite
    29 # - version 0.5 (2007-02-28 15:19) :
    30 # search on multiple words (slubman)
    31 # search in description is case insensitive (slubman)
    32 # - version 0.4 (2007-02-28 13:14) :
    33 # add possibility to search in repository (slubman)
    34 # add possibility to exclude repository in search (slubman)
    35 # - version 0.3 (2007-02-28) :
    36 # add possibility to display only installed packages (slubman)
    37 # add possibility to display only not installed packages (benoitc)
    38 # - version 0.1
    39 # initial release
    40 #
    41
    42 PACMAN_SOURCES="/var/lib/pacman"
    43 PWD=`pwd`
    44
    45 cd $PACMAN_SOURCES
    46
    47 myver="0.6"
    48
    49
    50 NAME_ONLY=0
    51 USE_COLOR="y"
    52 NOT_INSTALLED=0
    53 ONLY_INSTALLED=0
    54 IN="all packages"
    55 SKIP_REPO=()
    56 IN_REPO=()
    57 search_string=()
    58
    59 installed() {
    60 if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
    61 echo -e "\033[1;35m$1\033[1;0m \033[1;35m(*)\033[1;0m" >&2
    62 else
    63 echo "$1 (*)" >&2
    64 fi
    65 let nb=nb+1
    66 }
    67
    68 not_installed() {
    69 echo "$1" >&2
    70 let nb=nb+1
    71 }
    72
    73 msg() {
    74 if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
    75 echo -e "\033[1;32m==>\033[1;0m \033[1;1m$1\033[1;0m" >&2
    76 else
    77 echo "==> $1" >&2
    78 fi
    79 }
    80
    81 error() {
    82 if [ "$USE_COLOR" = "Y" -o "$USE_COLOR" = "y" ]; then
    83 echo -e "\033[1;31m==> ERROR:\033[1;0m \033[1;1m$1\033[1;0m" >&2
    84 else
    85 echo "==> ERROR: $1" >&2
    86 fi
    87 }
    88
    89 usage() {
    90 echo "pkgsearch $myver"
    91 echo "usage : $0 [-n] <searchstring>"
    92 echo
    93 echo "pkgsearch list all packages that contain your"
    94 echo "string and display installed packages"
    95 echo
    96 echo "Options"
    97 echo " -n, --name Search on pkgname only"
    98 echo " -m, --nocolor Disable colorized output messages"
    99 echo " -i, --installed Display only installed packages"
    100 echo " -sr, --skip-repo Exclude repo in search"
    101 echo " -ir, --ni-repo Search only in repo"
    102 echo " -s, --skip Display only not installed packages"
    103 echo " -h, --help Display usage"
    104 }
    105
    106 if [ $# -lt 1 ]; then
    107 usage
    108 exit 1
    109 fi
    110
    111 while [ "$#" -ne "0" ]; do
    112 case $1 in
    113 --installed|-i)
    114 ONLY_INSTALLED=1
    115 IN="only installed packages"
    116 ;;
    117 --help|-h)
    118 usage
    119 exit 0
    120 ;;
    121 --name|-n)
    122 NAME_ONLY=1
    123 ;;
    124 --nocolor|-m)
    125 USE_COLOR=n
    126 ;;
    127 --skip|-s)
    128 NOT_INSTALLED=1
    129 IN="only not installed packages"
    130 ;;
    131 --skip-repo|-sr)
    132 SKIP_REPO[${#SKIP_REPO[*]}]=$2
    133 shift
    134 ;;
    135 --in-repo|-ir)
    136 IN_REPO[${#IN_REPO[*]}]=$2
    137 shift
    138 ;;
    139 *)
    140 search_string[${#search_string[*]}]=$1
    141 ;;
    142 esac
    143 shift
    144 done
    145
    146 if [ "$NOT_INSTALLED" = "1" -a "$ONLY_INSTALLED" = "1" ]; then
    147 error "Error : Skip or show installed packages, but not both..."
    148 exit 0
    149 fi
    150
    151 nb=0
    152
    153 msg "Looking for \""${search_string[*]:-nothing}\""\n\tin ${IN}\n\tof ${IN_REPO[*]:-all repos}\n\texcluding ${SKIP_REPO[*]:-no repo}..."
    154 search_token=${search_string[0]}
    155 unset search_string[0]
    156 for word in ${search_string[*]}; do
    157 search_token="$search_token|$word"
    158 done
    159 search_token="($search_token)"
    160
    161 for repo in `find * -maxdepth 0 -type d`; do
    162 if ! [ $repo = 'local' ]; then
    163 if [ "$(echo ${SKIP_REPO[@]} | grep $repo)" ]; then
    164 continue
    165 fi
    166 if [ "$(echo ${IN_REPO[@]} | grep -v $repo)" ]; then
    167 continue
    168 fi
    169 cd $repo
    170 for pkg in `/bin/ls`; do
    171 if [ -f $pkg/desc ]; then
    172 if [ "$NAME_ONLY" = "1" ]; then
    173 if [ "$(echo $pkg | grep -E $search_token)" ]; then
    174 NAME=`grep -A 1 NAME $pkg/desc | tail -1`
    175 VERSION=`grep -A 1 VERSION $pkg/desc | tail -1`
    176 if [ -d $PACMAN_SOURCES/local/$pkg ]; then
    177 if [ "$NOT_INSTALLED" = "0" ]; then
    178 installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    179 fi
    180 else
    181 if [ "$ONLY_INSTALLED" = "0" ]; then
    182 not_installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    183 fi
    184 fi
    185 fi
    186 else
    187 if [ "$(grep -E -i $search_token $pkg/desc)" ]; then
    188 NAME=`grep -A 1 NAME $pkg/desc | tail -1`
    189 VERSION=`grep -A 1 VERSION $pkg/desc | tail -1`
    190 if [ -d $PACMAN_SOURCES/local/$pkg ]; then
    191 if [ "$NOT_INSTALLED" = "0" ]; then
    192 installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    193 fi
    194 else
    195 if [ "$ONLY_INSTALLED" = "0" ]; then
    196 not_installed "${nb} - [${repo}] - ${NAME} - ${VERSION}"
    197 fi
    198 fi
    199 fi
    200 fi
    201 fi
    202 done
    203 cd ..
    204 fi
    205 done
    206
    207 echo
    208 echo "$nb packages found.."
    209
    210 cd $PWD
    first posted by benoitc to shell archlinux packages bash ... saved by 2 persons ... 0 comments ... 1 year, 1 month
  3. claws-mail solaris compilation patch

    Patch to claws mail to enable solaris compilation

     1 Seulement dans claws-mail-3.0.2.new/src : .deps
    2
    3 Seulement dans claws-mail-3.0.2.new/src : Makefile
    4
    5 Sous-répertoire : claws-mail-3.0.2/src/common et claws-mail-3.0.2.new/src/common
    6
    7 Sous-répertoire : claws-mail-3.0.2/src/etpan et claws-mail-3.0.2.new/src/etpan
    8
    9 diff -u claws-mail-3.0.2/src/exporthtml.c claws-mail-3.0.2.new/src/exporthtml.c
    10
    11 --- claws-mail-3.0.2/src/exporthtml.c mar. août 21 11:17:14 2007
    12
    13 +++ claws-mail-3.0.2.new/src/exporthtml.c sam. oct. 6 00:59:50 2007
    14
    15 @@ -982,7 +982,11 @@
    16
    17 exporthtml_fmt_folder( ctl, htmlFile, rootFolder );
    18
    19
    20
    21 tt = time( NULL );
    22
    23 +#ifdef SOLARIS
    24
    25 + fprintf( htmlFile, "<p>%s</p>\n", ctime_r( &tt, buf, sizeof(buf) ) );
    26
    27 +#else
    28
    29 fprintf( htmlFile, "<p>%s</p>\n", ctime_r( &tt, buf ) );
    30
    31 +#endif
    32
    33 fprintf( htmlFile, "<hr width=\"100%%\"></hr>\n" );
    34
    35
    36
    37 fprintf( htmlFile, "</body>\n" );
    38
    39 Sous-répertoire : claws-mail-3.0.2/src/gtk et claws-mail-3.0.2.new/src/gtk
    40
    41 diff -u claws-mail-3.0.2/src/mbox.c claws-mail-3.0.2.new/src/mbox.c
    42
    43 --- claws-mail-3.0.2/src/mbox.c dim. sept. 16 20:16:42 2007
    44
    45 +++ claws-mail-3.0.2.new/src/mbox.c sam. oct. 6 01:00:18 2007
    46
    47 @@ -570,8 +570,13 @@
    48
    49 sizeof(buf));
    50
    51 extract_address(buf);
    52
    53
    54
    55 +#ifdef SOLARIS
    56
    57 fprintf(mbox_fp, "From %s %s",
    58
    59 + buf, ctime_r(&msginfo->date_t, buft, sizeof(buft)));
    60
    61 +#else
    62
    63 + fprintf(mbox_fp, "From %s %s",
    64
    65 buf, ctime_r(&msginfo->date_t, buft));
    66
    67 +#endif
    68
    69
    70
    71 buf[0] = '\0';
    72
    73
    74
    75 Sous-répertoire : claws-mail-3.0.2/src/pixmaps et claws-mail-3.0.2.new/src/pixmaps
    76
    77 Sous-répertoire : claws-mail-3.0.2/src/plugins et claws-mail-3.0.2.new/src/plugins
    first posted by slubman to diff patch solaris compilation ... saved by 1 person ... 0 comments ... 1 year, 1 month
  4. compilation claws-mail

    How to get claws-mail compiled on solaris

     1 # libetpan
    2 ./configure --prefix=/opt/slb CC=/usr/sfw/bin/gcc CXX=/usr/sfw/bin/g++ --disable-ipv6
    3 gmake
    4 su -c "gmake install"
    5
    6 # claws-mail
    7 export PATH=$PATH:/opt/slb/bin
    8
    9 # patch sources (cf: http://friendsnippets.com/snippet/84/)
    10
    11 ./configure --prefix=/opt/slb CC=/usr/sfw/bin/gcc CFLAGS="-I/usr/include -I/opt/slb/include/libetpan -D SOLARIS" LIBS="-L/usr/lib -L/opt/slb/lib -lX11" CXX=/usr/sfw/bin/g++ CXXFLAGS=-I/usr/include CXXLIBS=-L/usr/lib gtk_CFLAGS="-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12" gtk_LIBS="-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0" libmpd_CFLAGS=-I/opt/slb/include libmpd_LIBS="-L/opt/slb/lib -lmpd" libglade_CFLAGS="-I/usr/include/libglade-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12" libglade_LIBS="-lglade-2.0 -lgtk-x11-2.0 -lxml2 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0" --disable-ldap
    12
    13 gmake
    14
    15 su -c "gmake install"
    first posted by slubman to shell compilation solaris ... saved by 1 person ... 0 comments ... 1 year, 1 month
  5. compilation gmpc

    Les étapes pour copmiler gmpc sous solaris

     1 ###############
    2 # Compilation de libmpd
    3 ./configure --prefix=/opt/slb CC=/usr/sfw/bin/gcc CXX=/usr/sfw/bin/g++ CFLAGS="-I/usr/include -D CHAR_BIT=8"
    4 gmake
    5 su -c "gmake install"
    6
    7 ##############
    8 #Compilation de gmpc
    9 ./configure --prefix=/opt/slb CC=/usr/sfw/bin/gcc CFLAGS=-I/usr/include LIBS="-L/usr/lib -lX11" CXX=/usr/sfw/bin/g++ CXXFLAGS=-I/usr/include CXXLIBS=-L/usr/lib gtk_CFLAGS="-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12" gtk_LIBS="-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0" libmpd_CFLAGS=-I/opt/slb/include libmpd_LIBS="-L/opt/slb/lib -lmpd" libglade_CFLAGS="-I/usr/include/libglade-2.0 -I/usr/include/gtk-2.0 -I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12" libglade_LIBS="-lglade-2.0 -lgtk-x11-2.0 -lxml2 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0" --disable-sm --disable-tray
    10
    11 gmake
    12
    13 su -c "gmake install"
    14
    15 ####################
    16 # Compilation plugins gmpc
    17 ./configure --prefix=/opt/slb CC=/usr/sfw/bin/gcc CFLAGS='-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libxml2' LIBS='-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lxml2' gmpccaa_CFLAGS=-I/opt/slb/include gmpccaa_LIBS=-L/opt/slb/lib./configure --prefix=/opt/slb CC=/usr/sfw/bin/gcc CFLAGS='-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libxml2' LIBS='-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0 -lxml2' gmpccaa_CFLAGS=-I/opt/slb/include gmpccaa_LIBS=-L/opt/slb/lib
    18
    19 gmake
    20
    21 su -c "gmake install"
    first posted by slubman to shell compilation solaris ... saved by 1 person ... 0 comments ... 1 year, 2 months
  6. Simple serveur web en python

    version "minimaliste"

     1 from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
    2
    3 class MyServer(BaseHTTPRequestHandler):
    4 def do_GET(self):
    5 self.send_response(200, 'OK')
    6 self.send_header('Content-type', 'text/html')
    7 self.end_headers()
    8 self.wfile.write( "hello" )
    9
    10 @staticmethod
    11 def serve_forever(port):
    12 HTTPServer(('', port), MyServer).serve_forever()
    13
    14 if __name__ == "__main__":
    15 MyServer.serve_forever(8080)
    first posted by manatlan to python web http server ... saved by 5 persons ... 1 comments ... 1 year, 2 months
  7. synergy configuration (melody)

    Synergy configuration when using melody

     1 # sample synergy configuration file
    2 #
    3 # comments begin with the # character and continue to the end of
    4 # line. comments may appear anywhere the syntax permits.
    5 section: screens
    6 melody:
    7 kimberly:
    8 ashley:
    9 end
    10
    11 section: options
    12 switchDelay = 750
    13 screenSaverSync = true
    14 keystroke(super+left) = switchInDirection(left)
    15 keystroke(super+right) = switchInDirection(right)
    16 keystroke(super+k) = switchToScreen(kimberly)
    17 keystroke(super+m) = switchToScreen(melody)
    18 keystroke(super+a) = switchToScreen(ashley)
    19 end
    20
    21 section: links
    22 melody:
    23 left = kimberly
    24 right = ashley
    25
    26 kimberly:
    27 right = melody
    28 ashley:
    29 left = melody
    30
    31 end
    32
    33 section: aliases
    34 ashley:
    35 belenix
    36 end
    first posted by slubman to none synergy configuration ... saved by 1 person ... 0 comments ... 1 year, 2 months
  8. synergy configuration (kimberly-desk)

    Synergy configuration when using kimberly from desk

     1 # sample synergy configuration file
    2 #
    3 # comments begin with the # character and continue to the end of
    4 # line. comments may appear anywhere the syntax permits.
    5
    6 section: screens
    7 ashley:
    8 kimberly:
    9 melody:
    10 end
    11
    12 section: options
    13 switchDelay = 500
    14 screenSaverSync = true
    15 keystroke(super+left) = switchInDirection(left)
    16 keystroke(super+right) = switchInDirection(right)
    17 keystroke(super+k) = switchToScreen(kimberly)
    18 keystroke(super+m) = switchToScreen(melody)
    19 keystroke(super+a) = switchToScreen(ashley)
    20 end
    21
    22 section: links
    23 melody:
    24 left = kimberly
    25 right = ashley
    26
    27 kimberly:
    28 right = melody
    29
    30 ashley:
    31 left = melody
    32 end
    first posted by slubman to ini synergy configuration ... saved by 1 person ... 0 comments ... 1 year, 2 months
  9. synergy configuration (kimberly-bed)

    Synergy configuration when using kimberly from bed

     1 # sample synergy configuration file
    2 #
    3 # comments begin with the # character and continue to the end of
    4 # line. comments may appear anywhere the syntax permits.
    5
    6 section: screens
    7 ashley:
    8 kimberly:
    9 melody:
    10 end
    11
    12 section: options
    13 switchDelay = 500
    14 screenSaverSync = true
    15 keystroke(super+left) = switchInDirection(left)
    16 keystroke(super+right) = switchInDirection(right)
    17 keystroke(super+up) = switchInDirection(up)
    18 keystroke(super+down) = switchInDirection(down)
    19 keystroke(super+k) = switchToScreen(kimberly)
    20 keystroke(super+m) = switchToScreen(melody)
    21 keystroke(super+a) = switchToScreen(ashley)
    22 end
    23
    24 section: links
    25 melody:
    26 right = ashley
    27 down = kimberly
    28
    29 kimberly:
    30 up(0,50) = melody
    31 up(50,100) = ashley
    32
    33 ashley:
    34 left = melody
    35 down = kimberly
    36 end
    first posted by slubman to none synergy configuration ... saved by 1 person ... 0 comments ... 1 year, 2 months
  10. Yet another uname command

    Tested on linux, FreeBSD, MacOS X, and solaris with gcc and suncc

     1 /**
    2 DO WHAT THE FUCK YOU WANT TO, BUT IT'S NOT MY FAULT PUBLIC LICENSE
    3 Version 1, November 2007
    4
    5 Copyright (C) 2004 Sam Hocevar
    6 14 rue de Plaisance, 75014 Paris, France
    7 Everyone is permitted to copy and distribute verbatim or modified
    8 copies of this license document, and changing it is allowed as long
    9 as the name is changed.
    10
    11 DO WHAT THE FUCK YOU WANT TO, BUT IT'S NOT MY FAULT PUBLIC LICENSE
    12 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
    13
    14 0. You just DO WHAT THE FUCK YOU WANT TO, BUT IT'S NOT MY FAULT.
    15 **/
    16
    17 #include <stdlib.h>
    18 #include <stdio.h>
    19 #include <sys/utsname.h>
    20
    21 int main(void)
    22 {
    23 struct utsname uname_s;
    24
    25 if (uname(&uname_s) >= 0) {
    26 printf("Sysname\t: %s\nNodename: %s\nRelease\t: %s\nVersion\t: %s\nMachine\t: %s\n",
    27 uname_s.sysname,
    28 uname_s.nodename,
    29 uname_s.release,
    30 uname_s.version,
    31 uname_s.version);
    32 #ifdef _GNU_SOURCE
    33 printf("Domain\t: %s\n", uname_s.domainname);
    34 #endif
    35 printf("\n");
    36 return EXIT_SUCCESS;
    37 }
    38
    39 return EXIT_FAILURE;
    40 }
    first posted by slubman to c code inutilitaire ... saved by 2 persons ... 0 comments ... 1 year, 2 months
showing 10, 25, 50 items per pages

Pages : 1 2