|
How about:
where text is the string with the possible extraneous lines?http://stackoverflow.com/questions/1140958/whats-a-quick-one-liner-to-remove-empty-lines-from-a-python-string/1140966#1140966 |
Samstag, 13. August 2016
python remove empty lines from string
TinyCoreLinux
sudo fdisk /dev/mmcblk0
p drücken
Device Boot
Start End Blocks Id System
/dev/mmcblk0p1
342 2902 30720 c Win95 FAT32 (LBA)
/dev/mmcblk0p2
2903 5089280 61036536 83 Linux
Merke den
Startcylinder der partition “/dev/mmcblk0p2” hier 2903. Lösche
Partition 2 mit d. Jetzt mit n eine neue Partition erstellen. Als
Partitionsnummer 2 eingeben. Startzylinder (2903) eigeben. Als
Endzylinder nichts eingeben, somit wird der gesamte restliche platz
für die Partition verwendet. Mit w die Partiton erstellen.
Neustart
sudo resize2fs /dev/mmcblk0p2
http://forum.tinycorelinux.net/index.php?topic=18932.0
SCYL=$(sudo fdisk -l /dev/mmcblk0 | grep mmcblk0p2 | awk '{ print $2 }')
echo -e "p\nd\n2\nn\np\n2\n${SCYL}\n\n\np\nw\n" | sudo fdisk /dev/mmcblk0
sudo reboot
sudo resize2fs /dev/mmcblk0p2
Nun kann man
programme installieren:
tce-load -iw python
tce-load -iw curl
----
Um Konfiguration am System zu persistieren:
Persistence:
filetool.sh -b
Hier werden startup-Befehle eingegeben:
/opt/bootlocal.sh
filetool.sh -b nicht vergessen
----
pip installieren:
----
Um Konfiguration am System zu persistieren:
Persistence:
filetool.sh -b
Hier werden startup-Befehle eingegeben:
/opt/bootlocal.sh
filetool.sh -b nicht vergessen
----
pip installieren:
tc@box:~$ wget https://bootstrap.pypa.io/get-pip.py
tc@box:~$ sudo python get-pip.py
TinyCoreLinux
sudo fdisk /dev/mmcblk0
p drücken
Device Boot
Start End Blocks Id System
/dev/mmcblk0p1
342 2902 30720 c Win95 FAT32 (LBA)
/dev/mmcblk0p2
2903 5089280 61036536 83 Linux
Merke den
Startcylinder der partition “/dev/mmcblk0p2” hier 2903. Lösche
Partition 2 mit d. Jetzt mit n eine neue Partition erstellen. Als
Partitionsnummer 2 eingeben. Startzylinder (2903) eigeben. Als
Endzylinder nichts eingeben, somit wird der gesamte restliche platz
für die Partition verwendet. Mit w die Partiton erstellen.
Neustart
sudo resize2fs /dev/mmcblk0p2
Nun kann man
programme installieren:
tce-load -iw python
tce-load -iw curl
----
Um Konfiguration am System zu persistieren:
Persistence:
filetool.sh -b
Hier werden startup-Befehle eingegeben:
/opt/bootlocal.sh
filetool.sh -b nicht vergessen
----
Um Konfiguration am System zu persistieren:
Persistence:
filetool.sh -b
Hier werden startup-Befehle eingegeben:
/opt/bootlocal.sh
filetool.sh -b nicht vergessen
Donnerstag, 11. August 2016
linux restart network interfaces
all
/etc/init.d/networking restart
restart specific interface
ifdown wlan0
ifup wlan0
all interfaces
ifconfig -a
/etc/init.d/networking restart
restart specific interface
ifdown wlan0
ifup wlan0
all interfaces
ifconfig -a
Sonntag, 24. Juli 2016
rsync
Backup mit Timestamp
rsync -avb --suffix=_`date +%Y%m%d%H%M%S` /home/user/Downloads/rsync/A/ /home/user/Downloads/rsync/B/Ändert ein File im Startverzeichnis, so wird das im Zielverzeichnis mit einem Zeistempel versehen.
Bsp:
1. Rsync ausführen
1. File 1.txt wird von A nach B kopiert, beide Verzeichnisse haben das identische File 1.txt
2. In Folder A ändert das File 1.txt
3. Rsync ausführen
4. Das File 1.txt wird von A nach B kopiert. das Alte File in B wird mit einem Zeitstempel veresehen.
Backup ohne Timestamp (File wird im Ziel überschrieben)
rsync -av --size-only /home/andy/Downloads/rsync/A/ /home/andy/Downloads/rsync/B/Webdav mittels Visual-Basic verbinden
VB-Script zum verbinden von Webdav
NET USE gibt immer viele FehlerEine Alternative dazu ist folgednes Script
webdav.vbs
--------------------------------------------------
Set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "I:" , "https://www.ressource.com/path/to/folder/", false, "username", "password"
--------------------------------------------------
Quelle: http://ss64.com/vb/mapnetworkdrive.html
Syntax
objNetwork.MapNetworkDrive(strLocalDrive, strRemoteShare, [persistent], [strUser], [strPassword])
Key
objNetwork : A WScript.network object
strLocalDrive : The drive letter (e.g. L:)
strRemoteShare : The UNC path to the remote drive \\MyServer\MyPrinter
(String value)
persistent : True/False - store the mapping persistently in the users profile
default = false
strUser : The user name. (Optional)
strPassword : The password. (Optional)
Windows Webdav Dateibegrenzung
Windows begreznt die Dateigrösse normalerweise auf ca. 50 MB. Dies kann man wie folgt umgehen:
Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters
In the right pane, right-click the FileSizeLimitInBytes value, and then click Modify.
If you cannot see the FileSizeLimitInBytes value, right-click the blank space in the right pane, click New, click DWORD Value, type FileSizeLimitInBytes, and then click OK.
In the Edit DWORD Value box, click to select the Decimal option. In the box under Value data, type a value that is larger than the size of the file that you want to download. Click OK.
Note The default value for the file size limit is 50000000 bytes.
Quit Registry Editor. Restart the computer.
Click Start, click Run, type regedit, and then click OK.
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters
In the right pane, right-click the FileSizeLimitInBytes value, and then click Modify.
If you cannot see the FileSizeLimitInBytes value, right-click the blank space in the right pane, click New, click DWORD Value, type FileSizeLimitInBytes, and then click OK.
In the Edit DWORD Value box, click to select the Decimal option. In the box under Value data, type a value that is larger than the size of the file that you want to download. Click OK.
Note The default value for the file size limit is 50000000 bytes.
Quit Registry Editor. Restart the computer.
Sonntag, 15. Mai 2016
Regex Control Charackter without LineBreak, Tabs etc
Steuerzeichen in Regex lassen sich mit :cntrl: suchen, jedoch werden so auch normale Zeilenumbrüche, Tabulatoren etc ersetzt, wenn man diese Leerzeichen behalten möchte kann man den Folgenden String verwenden:
lookaheads
(?![\s])[[:cntrl:]]
Quelle: http://stackoverflow.com/a/17328119
alt+04 -> EOT
Quelle: http://www.theasciicode.com.ar/
lookaheads
(?![\s])[[:cntrl:]]
Quelle: http://stackoverflow.com/a/17328119
Ein paar Steuerzeichen mit der Tastatur erzeugen:
alt+03 -> ETXalt+04 -> EOT
Quelle: http://www.theasciicode.com.ar/
Samstag, 14. Mai 2016
cyanogenmod 9505
https://dl.twrp.me/jfltexx/
Download:
- http://get.cm/?device=jfltexx
- http://opengapps.org/ (Platform: ARM, Android: 6, Variant: Pico)
Recovery
Mit USB-Verbinden und folgende flashen
1. CM
2. GAPPS
Fehler:
Setup Wizard has stopped
Here is a method that you can do without whiping,
Boot into TWRP Recovery
Mount System ( Mount → check System )
Advanced → File Manager
Browse to /system/priv-app/Setup-Wizard
Delete it
how-do-i-remove-gapps-from-cyanogenmod.
Seems like you can remove it without a reinstall
adb shell
su
mount -o rw,remount /system
rm -R /system/addon.d
Source here : How to fix wrong Google apps
http://android.stackexchange.com/questions/65762/how-do-i-remove-gapps-from-cyanogenmod
Download:
- http://get.cm/?device=jfltexx
- http://opengapps.org/ (Platform: ARM, Android: 6, Variant: Pico)
Recovery
Mit USB-Verbinden und folgende flashen
1. CM
2. GAPPS
Fehler:
Setup Wizard has stopped
Here is a method that you can do without whiping,
Boot into TWRP Recovery
Mount System ( Mount → check System )
Advanced → File Manager
Browse to /system/priv-app/Setup-Wizard
Delete it
how-do-i-remove-gapps-from-cyanogenmod.
Seems like you can remove it without a reinstall
adb shell
su
mount -o rw,remount /system
rm -R /system/addon.d
Source here : How to fix wrong Google apps
http://android.stackexchange.com/questions/65762/how-do-i-remove-gapps-from-cyanogenmod
Samstag, 2. Januar 2016
Linux automount smb
etc/fstab
//ip/share /media/asustor_share cifs credentials=/home/andy/.smbcredentials,iocharset=utf8,sec=ntlm,noauto,user 0 0
user= allow user to mount smb...
subl ~/.smbcredentials
username=msusername
password=mspassword
chmod 600 .smbcredentials
source: https://wiki.ubuntu.com/MountWindowsSharesPermanently
//ip/share /media/asustor_share cifs credentials=/home/andy/.smbcredentials,iocharset=utf8,sec=ntlm,noauto,user 0 0
user= allow user to mount smb...
subl ~/.smbcredentials
username=msusername
password=mspassword
chmod 600 .smbcredentials
source: https://wiki.ubuntu.com/MountWindowsSharesPermanently
Samstag, 17. Oktober 2015
Alias in Linux Mint
/etc/bash.bashrc
Mittwoch, 14. Oktober 2015
Linux sort CSV file
sort -t";" -k2 -k1 -k3 list.csv
oder
oder
sort --field-separator=';' --key=2,1,3
Input:
3;1;2
2;1;3
3;2;1
1;2;3
2;3;1
1;3;2
Output:
2;1;3
3;1;2
1;2;3
3;2;1
1;3;2
2;3;1
Dienstag, 6. Oktober 2015
cd into a dir with - minus
the dir:
-2015-10-05-2044
cd ./-2015-10-05-2044
Sonntag, 4. Oktober 2015
Linux count Files in directory
ls -l | grep ^- | wc -l # Files
ls -l | grep ^d | wc -l # Directories
ls -l | grep ^l | wc -l # Links
Count with specific ending (eg. mkv):
ls -l | grep -i ^-.*mkv | wc -l
ls -l | grep ^d | wc -l # Directories
ls -l | grep ^l | wc -l # Links
Count with specific ending (eg. mkv):
ls -l | grep -i ^-.*mkv | wc -l
Compile unrar from Source In Linux
First see whats the most recent version:
ftp://ftp.rarlab.com/rar/
look for unrarsrc-*.tar.gz
wget http://www.rarlab.com/rar/unrarsrc-4.1.4.tar.gz
tar xzvf unrarsrc-4.1.4.tar.gz # replace Version
cd unrar
make
sudo make install
Samstag, 26. September 2015
Linux Filename im Terminal ändern
Filename Punkte und Leerzeichen durch _ ersetzen
rename 's/[. -]+/_/g' *Lowercase
for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; doneErsetzen
rename 's/hier_ist_der_zu_ersetzende_text//g' *pyload auf bestimmte Version downgraden
Folgendes in einem Terminal ausführen:
pyLoadCore --quit
cd ~/
rm -R pyload201508/
mkdir pyload201508
cd pyload201508/
wget https://github.com/pyload/pyload/archive/5e15580202c44628f2fbfabad0c3f693975fb3c9.zip
unzip *.zip
mv pyload* pyload
sudo -s
rm -R /usr/share/pyload
mv pyload/ /usr/share/
exit
cd /usr/share/pyload/
./pyLoadCore.py --daemon
pyLoadCore --quit
cd ~/
rm -R pyload201508/
mkdir pyload201508
cd pyload201508/
wget https://github.com/pyload/pyload/archive/5e15580202c44628f2fbfabad0c3f693975fb3c9.zip
unzip *.zip
mv pyload* pyload
sudo -s
rm -R /usr/share/pyload
mv pyload/ /usr/share/
exit
cd /usr/share/pyload/
./pyLoadCore.py --daemon
ddrescue
Image eines Datenträgers erstellen
Image erstellen:
clear && date && sudo ddrescue /dev/sdb /media/andy/iomega/raspberrypi_pyload.img && date
Image zurückspielen:
date && sudo ddrescue /media/andy/iomega/raspberrypi.img /dev/sdb --force && date
Installation
sudo apt-get install gddrescue
Image erstellen:
clear && date && sudo ddrescue /dev/sdb /media/andy/iomega/raspberrypi_pyload.img && date
Image zurückspielen:
date && sudo ddrescue /media/andy/iomega/raspberrypi.img /dev/sdb --force && date
Installation
sudo apt-get install gddrescue
Mittwoch, 26. August 2015
Pfad eines Linux Comandos anzeigen
You can use "type" or "whereis" command to find out which command shell executes and to print binary (command) file location for specified command.
whereis command example
Display ls command location along with man page path:whereis ls
Output:
ls: /bin/ls /usr/share/man/man1p/ls.1p.gz /usr/share/man/man1/ls.1.gz
type command example
Find out which command the shell executes:type -a ls
Output:
ls is aliased to `ls --color=tty'
ls is /bin/ls
Source: http://www.cyberciti.biz/tips/find-linux-unix-command-location.html
Sonntag, 22. März 2015
Batch-File An Taskleiste anheften
Leider ist es nicht so leicht eine Batchdatei an die Windows 7 Taskleiste anzuheften. Mit diesem Trick geht’s:
1. Die anzuheftende Batchdatei von batch.bat nach batch.exe umbenennen.
2. Die Batchdatei nun in die Taskleiste ziehen und anheften.
3. Nun die original Batchdatei wieder umbenennen in batch.bat.
4. Mit gedrückter Shift-Taste mit der rechten Mausstaste auf die Verknüpfung klicken und auf Eigenschaften klicken.
5. Unter Ziel nun den korrekten Pfad zur Batchdatei eingeben. Es reicht aus, aus dem .exe ein .bat zu machen.
1. Die anzuheftende Batchdatei von batch.bat nach batch.exe umbenennen.
2. Die Batchdatei nun in die Taskleiste ziehen und anheften.
3. Nun die original Batchdatei wieder umbenennen in batch.bat.
4. Mit gedrückter Shift-Taste mit der rechten Mausstaste auf die Verknüpfung klicken und auf Eigenschaften klicken.
5. Unter Ziel nun den korrekten Pfad zur Batchdatei eingeben. Es reicht aus, aus dem .exe ein .bat zu machen.
Text Files per CommandLine kombinieren:
copy *.js bigfile.txt
Sonntag, 27. Juli 2014
Wake-On-Lan Broadcast DIR-826l
In Firefox, in Firebug's console, execute the following:
check_LAN_ip=function(){return true;};
check_address=function(){return true;};
and then try to save the settings. Let me know if it works.
Freitag, 2. Mai 2014
Tabelle Flachklopfen
SELECT * FROM (
SELECT 'OA' OBJECT_NAME, 'EU' REGION FROM DUAL UNION ALL
SELECT 'OB' OBJECT_NAME, 'EU' REGION FROM DUAL UNION ALL
SELECT 'OC' OBJECT_NAME, 'EU' REGION FROM DUAL UNION ALL
SELECT 'OA' OBJECT_NAME, 'US' REGION FROM DUAL UNION ALL
SELECT 'OB' OBJECT_NAME, 'AS' REGION FROM DUAL UNION ALL
SELECT 'OC' OBJECT_NAME, 'AS' REGION FROM DUAL ) S
PIVOT (COUNT (*) FOR REGION IN ('EU', 'US', 'AS'))
Freitag, 25. April 2014
Linux Mint gedit Problem
The following packages have unmet dependencies:
gedit-plugins : Depends: gedit (>= 3.8) but 2.30.5+petra is to be installed
E: Unable to correct problems, you have held broken packages.
apt purge gedit gedit-common
apt install gedit/saucy gedit-common/saucy
Source:
Donnerstag, 10. April 2014
ORA-01007: variable not in select list
the Problem was a DB-Link has been recreated and the Objects on that Schema had not been recompiled.
SET SERVEROUTPUT ON;
DECLARE
c SYS_REFCURSOR;
s_dummy VARCHAR2 (1);
s_dummy_culprit VARCHAR2 (1);
BEGIN
OPEN c FOR 'select dummy from dual';
FETCH c
INTO s_dummy, s_dummy_culprit; --<== here is the problem
CLOSE c;
END;
/
Freitag, 28. März 2014
Select count approximately
select num_rows from user_tables
where table_name = 'XY'
Dienstag, 25. Februar 2014
Notepad++ Makro Generator "Find In Files"
1: SET SERVEROUTPUT ON;
2: SET LINES 256
3: SET TRIMOUT ON
4: SET SPACE 1
5: SET tab OFF
6: DECLARE
7: dummy NUMBER;
8: BEGIN
9: FOR n IN (SELECT 'A.B' func FROM DUAL
10: UNION ALL
11: SELECT 'A.C' func FROM DUAL) LOOP
12: DBMS_OUTPUT.put_line ('<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />');
13: DBMS_OUTPUT.put_line ('<Action type="3" message="1601" wParam="0" lParam="0" sParam="' || n.func || '" />');
14: DBMS_OUTPUT.put_line ('<Action type="3" message="1625" wParam="0" lParam="0" sParam="" />');
15: DBMS_OUTPUT.put_line ('<Action type="3" message="1653" wParam="0" lParam="0" sParam="C:\repo_facts\branches\" />');
16: DBMS_OUTPUT.put_line ('<Action type="3" message="1652" wParam="0" lParam="0" sParam="*.*" />');
17: DBMS_OUTPUT.put_line ('<Action type="3" message="1702" wParam="0" lParam="32" sParam="" />');
18: DBMS_OUTPUT.put_line ('<Action type="3" message="1701" wParam="0" lParam="1656" sParam="" />');
19: END LOOP;
20: EXCEPTION
21: WHEN NO_DATA_FOUND THEN
22: NULL;
23: WHEN OTHERS THEN
24: NULL;
25: END;
26: /
Montag, 27. Januar 2014
Samstag, 25. Januar 2014
unrar all files in a directory
Ohne Passwort
Mit Passwort
nohup find . -regex \.\*part[0]?[0]?1.rar -exec unrar x -inul {} \; &
Mit Passwort
nohup find . -regex \.\*part[0]?[0]?1.rar -exec unrar x -inul -pPASSWORD {} \; &
Mittwoch, 22. Januar 2014
pyLoad@nas doesn't unpack after download
be shure that you have installed unrar and unzip
then go into /bin
cd /bin
find the location of unrar an unzip:
find / -iname unrar
find / -iname unzip
now create two symlink:
ln -s /opt/bin/unrar
ln -s /opt/bin/unzip
Now pyLoad should extract after finish downloading a package
then go into /bin
cd /bin
find the location of unrar an unzip:
find / -iname unrar
find / -iname unzip
now create two symlink:
ln -s /opt/bin/unrar
ln -s /opt/bin/unzip
Now pyLoad should extract after finish downloading a package
PL/SQL Generate Range of number
I had the problem to select a number field with leading blanks.. this is my solution:
SELECT LPAD (
LEVEL + doc_num_from - 1
,12
,' '
)
AS rnum
FROM DUAL
CONNECT BY LEVEL < doc_num_to - doc_num_from + 2
SELECT LPAD (
LEVEL + doc_num_from - 1
,12
,' '
)
AS rnum
FROM DUAL
CONNECT BY LEVEL < doc_num_to - doc_num_from + 2
Freitag, 30. August 2013
RegExp Snippets
Insert Statements in Oracle SQL:
INSERT\s+INTO\s+(cache|cache_bootstrap|cache_field|cache_form)[^\;]+Mittwoch, 28. August 2013
Freitag, 21. Juni 2013
Word: Inhaltsverzeichnis zusätzliche Ebene einfügen
Inhaltsverzeichnis markieren
alt+f9 drücken
An der Stelle des Inhaltsverzeichnisses wo 1-3 steht, einfach 1-4 eintragen.
Danach wieder alt+f9 drücken
dann das gesamte Inhaltsverzeichnis aktualisieren
Montag, 4. März 2013
OWB getting started Tipps
Alle Objekte minimieren:
. CTRL+A -> Graph -> Minimize
Vogelperspektive
. View -> Birds-Eye
. CTRL+A -> Graph -> Minimize
Vogelperspektive
. View -> Birds-Eye
Mittwoch, 27. Februar 2013
OWB auf Englisch umstellen
Am Schluss beider
Files die folgende Zeile einfügen:
AddVMOption
-Duser.language=en
Nach einem Neustart
des OWBs ist die Sprache nun auf English eingestellt
Quelle:
http://blog.trivadis.com/b/danischnider/archive/2011/08/25/change-the-language-in-oracle-warehouse-builder.aspx
Mittwoch, 9. Januar 2013
SSRS Kopfzeile beim Scrollen fixieren
Advanced Mode:

Row Groups:

Es wird die erste Zelle Markiert

Im Properties Menu:
Nun bleibt die erste Zeile beim Scrollen sichtbar.
Row Groups:
Es wird die erste Zelle Markiert
Im Properties Menu:
Nun bleibt die erste Zeile beim Scrollen sichtbar.
Donnerstag, 27. Dezember 2012
SSRS Seitenumbrüche in Reports entfernen
Damit ein Report auf einer Seite Dargestellt wird, muss folgende Einstellung gemacht werden:
Abonnieren
Kommentare (Atom)


