Netzentrale
鲁斯兰
  • 新浪微博
  • Linux FAQ
  • CMS FAQ
  • Windows FAQ
  • Forum
  • Contacts
23 06 2020

configure: error: cannot run C compiled programs

rooslan macos brew, macos 1

tigerbrew: checking whether we are cross compiling… configure: error: in ‚/private/tmp/…/xz-5.2.1‘:
configure: error: cannot run C compiled programs.

After upgrading to Mac OS X El Capitan brew (bzw.tigerbrew) can’t install wget and mc.

1
brew install mc wget

It returned the following error:
checking whether we are cross compiling… configure: error: in ‚/private/tmp/…/xz-5.2.1‘:
configure: error: cannot run C compiled programs.

Solution.
From the error log, it seemed related to compiling library code. To install Xcode command line tools, run the following command:

1
xcode-select --install

via: @f5.works

05 11 2019

gcc: get livestream url

rooslan Languages C#, Google API, Youtube 0

To get the livestream video url from youtube you’ll need to use Google API-key and channel URL.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include "funk.h"
#define MY_INITIAL_BUFFER_SIZE (1)
 
int main(int argc, char **argv)
{
    CURLcode result;
    struct my_buffer buffer;
    char curl_error[CURL_ERROR_SIZE];
 
    buffer.memory = malloc(MY_INITIAL_BUFFER_SIZE);
    buffer.size = MY_INITIAL_BUFFER_SIZE;
    buffer.used = 0;
 
    result = get_url("https://www.googleapis.com/youtube/v3/search?part=snippet&amp;channelId=[YOUR_CHANNEL_ID]&amp;eventType=live&type=video&amp;key=[YOUR_API_KEY]", &amp;buffer, curl_error);
    if (result == 0)
{
char * inhalt = NULL;
inhalt = malloc(1 + buffer.used);
memcpy(inhalt, buffer.memory, buffer.used);
inhalt[buffer.used] = '\0';
if (inhalt)
{
int pos = strpos(inhalt, "\"videoId\": \"", 0);
if (pos == -1) {}
int endpos = strpos (inhalt, "\"", pos+10);
char vid[12];
substring(vid, inhalt, endpos+1, endpos - pos);
FILE * fp;
fp = fopen ("/var/www/html/url.php", "w");
fprintf(fp, "<script> jsvid = \"https://www.youtube.com/watch?v=%s%s", vid, "\";</script>");
fclose(fp);
char line[75];
char * ssh = "ssh uhla@elabu.ga -p 12036 echo ";
char * fname = " \\>\\> /var/www/html/url.php";
char * command;
asprintf(&amp;command, "%s%s%s", ssh, vid, fname);
puts(command);
FILE *cmd = popen(command, "r");
// popen("ssh uhla@elabu.ga -p 12036 pidof ffmpeg", "r");
fgets(line, 75, cmd);
pid_t pid = strtoul(line, NULL, 10);
printf("pid: %d", pid);
pclose(cmd);
     }
else
{
       puts(curl_error);
}
} // result == 0
   return 0;
} // main

declarations funk.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef FUNK_H
# define FUNK_H
 
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
 
struct my_buffer {
    unsigned char *memory;
    size_t size;
    size_t used;
};
 
size_t my_curl_write(char *ptr, size_t size, size_t nmemb, void *userdata);
CURLcode get_url(const char *url, struct my_buffer *buffer, char *curl_error);
int strpos(char *hay, char *needle, int offset);
char* substring(char *destination, const char *source, int beg, int n);
 
#endif

declarations funk.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
 
#include "funk.h"
 
#define MY_MAXIMUM_BUFFER_SIZE (4 * 1024 * 1024)
 
extern size_t my_curl_write(char *ptr, size_t size, size_t nmemb, void *userdata){
    struct my_buffer *buffer = userdata;
    size_t needed = size * nmemb;
 
    if (needed > (buffer->size - buffer->used)) {
        unsigned char *new_memory;
        size_t new_size = 2 * buffer->size;
        while (needed > (new_size - buffer->used)) {
            new_size *= 2;
            if (new_size > (MY_MAXIMUM_BUFFER_SIZE)) {
                return 0;
            }
        }
        new_memory = realloc(buffer->memory, new_size);
        if (!new_memory) {
            return 0;
        }
        buffer->memory = new_memory;
        buffer->size = new_size;
    }
    memcpy(buffer->memory + buffer->used, ptr, needed);
    buffer->used += needed;
    return needed;
}
 
extern CURLcode get_url(const char *url, struct my_buffer *buffer, char *curl_error) {
    CURLcode result;
    CURL *my_curl = curl_easy_init();
 
    curl_easy_setopt(my_curl, CURLOPT_ERRORBUFFER, curl_error);
    curl_easy_setopt(my_curl, CURLOPT_FOLLOWLOCATION, 1);
    curl_easy_setopt(my_curl, CURLOPT_URL, url);
    curl_easy_setopt(my_curl, CURLOPT_WRITEFUNCTION, my_curl_write);
    curl_easy_setopt(my_curl, CURLOPT_WRITEDATA, buffer);
 
    result = curl_easy_perform(my_curl);
 
    curl_easy_cleanup(my_curl);
 
    return result;
}
 
int strpos(char *hay, char *needle, int offset)
{
   char haystack[strlen(hay)];
   strncpy(haystack, hay+offset, strlen(hay)-offset);
   char *p = strstr(haystack, needle);
   if (p)
      return p - haystack+offset;
   return -1;
}
 
char* substring(char *destination, const char *source, int beg, int n)
{
// extracts n characters from source string starting from beg index
// and copy them into the destination string
while (n > 0)
{
*destination = *(source + beg);
 
destination++;
source++;
n--;
}
 
// null terminate destination string
*destination = '\0';
 
// return the destination string
return destination;
}

28 10 2019

LoadString (C++ Builder)

Uchla Languages 0

1
2
3
4
5
6
7
8
9
10
11
12
#define LOAD_LIBRARY_AS_IMAGE_RESOURCE 0x00000020
        TCHAR Buffer[MAX_PATH];
        AnsiString Description;
 
        HINSTANCE hInstance = LoadLibraryEx("C:\\hidserv86.dll", 0, LOAD_LIBRARY_AS_IMAGE_RESOURCE);
if (hInstance != NULL)
{
                LoadString(hInstance, 101, Buffer, MAX_PATH);
                Description = Buffer;
                ShowMessage(Description);
                FreeLibrary(hInstance);
}

05 09 2019

Neufahrn

rooslan nützlich S-Bahn 0


Im Bahnhof Neufahrn teilt sich die S-Bahn S1 zum Flughafen.


Der vordere Zugteil verkehrt nach Freising, der hintere Zugteil zum Flughafen.

04 09 2019

tectudssr

Uchla Java Android, Java, VCE 10

App updated 10.10.2020
(added word wrap function)

I’ve cobbled an Android App, shortly after A.VCE+ dead.
tectudssr cannot show pictures and can’t doing a lot of other things, but it serves me faithfully for text quizes.

Download the latest APK – v. 2.36

How to use the Application?
1. Install SumatraPDF
2. Open the pdf-test from gratisExam (didn’t tested other pdf-s) using SumatraPDF, „Save as“ -> „Save as .txt“
3. Удаляю из этого текстового файла вопросы в которых нет вариантов ответа или правильного ответа (редко).
4. Rename this file to tect.txt and move it to the Download folder of tablets sd-card

Back – swipe left or Vol+
Forward – swipe right or Vol-

I’m choosing right answers (checkboxes or radiobuttons depends on answers)

now, tectudssr will show correct answers – click the bottom middle button (or swipe up):

In cases of segmentation faults, incorrect quiz parsing (and so on) leave a comment or write a mail (attach the pdf).
Android v6+ required.

Previous version: tectudssr-2.11.apk.

01 03 2019

Telegram error

Uchla nützlich telegram 1

К сожалению, группа временно недоступна на вашем устройстве, поскольку ее модераторам необходимо удалить порнографические материалы, опубликованные пользователями. Как только группу приведут в порядок, она снова станет доступна.

Sorry, this group is temporarily inaccessible on your device to give its moderators time to clean up after users who posted pornographic content. We will reopen the group as soon as order is restored.

Diese Gruppe ist leider auf deinem Gerät vorübergehend nicht erreichbar, um den Moderatoren Zeit zu geben, pornographische Inhalte zu entfernen, die von Nutzern veröffentlicht wurden. Wir werden die Gruppe wieder öffnen, sobald die Ordnung wiederhergestellt ist.

13 04 2017

Decrease LVM size & migrating to normal partition

Uchla admin, nix LVM 0

The main goal of these described steps is to virtualize an asterisk server – from the blade server into the VMWare virtual machine.


Asterisk was set up few years ago on two partitions – /boot (100mb) and LVM (500gb – 495gb for root and 5gb swap). But actually used space on the hard drive was less than 6-8 gb.
As backups are done using VMWare tools, I’ve decided to away from LVM type 8e, decrease it to 20gb and copy to a normal partition 83.
That’s why I’ve skip the step of making backups.
So I’ve made sector-by-sector copy of the hard drive using Acronis True Image into one *.tib file. And then have restored the archive into the virtual machine vmdk-HDD. There are one more advantage of going away from LVM – True Image extra steps to restore LVM volumes to prepared LVMs

1
2
3
4
/dev/sda1 - 100mb /boot
/dev/sda2 — 500gb LVM 8e:
/dev/VolGroup00/LogVol00 — 495gb root /
/dev/VolGroup00/LogVol01 — 5gb swap

The next step – boot VM from system-rescue-cd(.org) and

1
e2fsck -fa /dev/VolGroup00/LogVol00

Missing e2fsck check wont allow you to resize the volumes.
vgdisplay and lvdisplay commands may provide you any detailed information about the existing LVM volumes.
Decreasing the volume to 20gb:

1
lvresize -r -L -475G /dev/VolGroup00/LogVol00

(the option „-r“ let us omit using resize2fs – we decreasing file system size simultaneously with the volume).
Now, according to the pvmove man-page we have the possibility to move extents around on the same device:

1
pvmove --alloc anywhere /dev/sda2

In case of message „No extents available for allocation“ (overlapping regions are forbidden) we could move the volume in 2 steps:

1
pvmove --alloc anywhere /dev/sda2:1000-1999

Start and the end can be found via command

1
pvs -v --segments /dev/sda2

Further we shrinking the physical volume to 20gb:

1
pvresize -v --setphysicalvolumesize 20G /dev/sda2

Run fdisk /dev/sda, and at its prompt, run p to look at your existing partitions. Note the starting sector number of your sda2 partition. Then delete the sda2 partition — this doesn’t touch the actual data, just removes the record of where it starts and ends — and create a new sda2 with the same starting sector and a size of 20.1G. The partition’s type code should be 8e, „Linux LVM“.
Change the grub.conf content to point / (root) to a new /dev/sda2:

I’ve also commented the volume group line in /etc/mtab.
Now boot from the Centos rescue CD and use F5 option (we’ve downloaded the same version which was installed).
Do chroot into /mnt/sysimage and type the next:

1
mkinitrd -v -f --omit-lvm-modules --without-dmraid initrd2.6.18-348.1.1.img 2.6.18-348.1.1

Finally, it’s time to creating new sda3 partition (swap), point to it in fstab file, reboot and begin to reconfigure network settings.

06 03 2017

SFTP server, Debian 7 Wheezy, one directory

Uchla admin, nix chroot, one folder 0

cat /etc/passwd

1
2
ftp:x:107:65534::/srv/ftp:/bin/false
sftp_user:x:1001:1003::/home/sftp_user:/bin/sh

cat /etc/group
(чтобы sftp_user получил доступ к папке сайта в корне, он также находится в группе www-data)

1
2
sftp_group:x:1002:sftp_user
sftp_user:x:1003:www-data

Ставим 755 на директории public_html и www и делаем рута владельцем („…All components of the pathname must be root-owned directories that are not writable by any other user or group…“, такое же требование есть у ftpd-серверов в случае с пользовательским chroot):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
root@web:~# ls -la /var/
итого 56
drwxr-xr-x 14 root    root     4096 Дек 16 12:34 .
drwxr-xr-x 23 root    root     4096 Мар  3 13:13 ..
drwxr-xr-x  4 root    www-data 4096 Мар  2 14:48 public_html
root@web:~# ls -la /var/public_html/
итого 16
drwxr-xr-x  4 root     www-data 4096 Мар  2 14:48 .
drwxr-xr-x 14 root     root     4096 Дек 16 12:34 ..
drwxr-xr-x  2 www-data www-data 4096 Дек 28 09:48 pub
drwxr-xr-x  4 root     www-data 4096 Мар  3 13:24 www
root@web:~# ls -la /var/public_html/www/
итого 16
drwxr-xr-x 4 root     www-data 4096 Мар  3 13:24 .
drwxr-xr-x 4 root     www-data 4096 Мар  2 14:48 ..
drwxrwsr-x 8 www-data www-data 4096 Мар  4 12:15 sap.ru

После входа по SFTP, SSHD меняет эффективного пользователя на залогинившегося – работает не от рута (т.е. выполнивший вход не сможет писать в корень www или уйти выше).
Добавляем в конец sshd_conf

1
2
3
4
5
6
7
Subsystem sftp internal-sftp
Match Group sftp_group
X11Forwarding no
AllowTCPForwarding no
AllowAgentForwarding no
ForceCommand internal-sftp
ChrootDirectory /var/public_html/www/


P.S. Скачать пересобранный vsftpd 2.3.5 с опцией allow_writeable_chroot=YES:
vsftpd_2.3.5-10~update.1_amd64
vsftpd_2.3.5-10-update.1_i386

31 08 2016

Pound proxy под Windows

Uchla admin proxy, reverse proxy 0

Pound это обратный прокси и балансировщик нагрузки для протоколов HTTP и HTTPS. Отличительные способности включают в себя возможность фронтальной обработки SSL и распределения на обслуживающие сервера в виде HTTP, дезинфекция HTTP и HTTPS на предмет неправильно сформированных запросов, балансировка по состоянию сессии и другим параметрам (URL, идентификации (Basic HTTP), кукам (cookies), HTTP headers). Полная поддержка WebDAV. В режиме балансировки он сам определяет, отвалился ли бекэнд и перенаправляет весь трафик на оставшиеся, периодически чекая отвалившейся хост. Как только Backend восстановился, Pound начинает перебрасывать трафик и на него.

Pound имеет встроенный механизм балансировки и проверки работоспособности обслуживающих серверов. Разработчики отмечают что дизайн изначально был спланирован из принципа не вмешиваться в проходящий трафик, исходя из этого не используют методы встраивания “печенек” и т.п. в сессии, довольно таки на прямую намекая на противоположность методам HAProxy. Несмотря на это замечание, может встраивать в хедэры “X-Forwarded-for” для передачи на бэкенд сервера IP адрес пользователя с целью записи в логи и т.п. Изначально проект разрабатывался как фронтэнд для нескольких серверов Zope (ZEO). Считается легковесным и безопасным, т.к. практически не обращается к диску (кроме чтения сертификатов SSL во время загрузки). Встроенных механизмов отказоустойчивости не имеет.
Проект скромен, манией величия не страдает. Установка и настройка не представляют больших сложностей. Существуют неофициальные пакеты под крупные сборки Линукса, на сайте распространяется только в виде сорсов. Официально тестирован на Линуксе, OpenBSD и Solaris. О использующих проект данных не много, но часто упоминается как решение для балансировки HTTPS в связке с другими решениями.

Чтобы скомпилировать Pound под Windows, используйте CygWin со следующими пакетами: coreutils, cygutils, findutils, gcc-core, gcc-g++, m4, openssl, openssl-devel, rebase, tar, w32api. Их необходимо отметить во время установки вот так:

Копируем следующие файлы в папку, например, C:\Apps\Pound:
cygssl-0.9.8.dll
cygcrypto-0.9.8.dll
cygrunsrv.exe
cygwin1.dll
pound.exe
cygz.dll

Запускаем Cygwin Terminal, переходим в папку с исходниками Pound и выполняем команду:

1
./configure --without-ssl --build=i686-pc-cygwin

Затем даем команду

1
make

Чтобы запустить „фунт“ как службу Windows, с ведением логов, используйте следующую команду с утилитой cygrunsrv от CygWin:

1
2
3
cygrunsrv --install Pound --path C:\Apps\Pound\pound.exe --args "-f
C:\Apps\Pound\pound.cfg" --stdout C:\Apps\Pound\pound.log --stderr
C:\Apps\Pound\pound.log

Пример конфига, показывающий весь широкий функционал Pound:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## Minimal sample pound.cfg
######################################################################
## global options:
User        "www-data"
Group       "www-data"
#RootJail   "/chroot/pound"
## Logging: (goes to syslog by default)
##  0   no logging
##  1   normal
##  2   extended
##  3   Apache-style (common log format)
LogLevel    1
## check backend every X secs:
Alive       30
## use hardware-accelleration card supported by openssl(1):
#SSLEngine  ""
######################################################################
## listen, redirect and ... to:
# Here is a more complex example: assume your static images (GIF/JPEG) are to be served from  a  single  back-end  192.168.0.10.  In
#       addition,  192.168.0.11  is  to  do  the  hosting for www.myserver.com with URL-based sessions, and 192.168.0.20 (a 1GHz PIII) and
#       192.168.0.21 (800Mhz Duron) are for all other requests (cookie-based sessions).  The logging will be done by the back-end servers.
#       The configuration file may look like this:
              # Main listening ports
              ListenHTTP
                  Address 202.54.1.10
                  Port    80
                  Client  10
              End
              ListenHTTPS
                  Address 202.54.1.10
                  Port    443
                  Cert    "/etc/pound/pound.pem"
                  Client  20
              End
              # Image server
              Service
                  URL ".*.(jpg|gif)"
                  BackEnd
                      Address 192.168.1.10
                      Port    80
                  End
              End
             # Virtual host www.myserver.com
              Service
                  URL         ".*sessid=.*"
                  HeadRequire "Host:.*www.nixcraft.com.*"
                  BackEnd
                      Address 192.168.1.11
                      Port    80
                  End
                  Session
                      Type    PARM
                      ID      "sessid"
                      TTL     120
                  End
              End
              # Everybody else
              Service
                  BackEnd
                      Address 192.168.1.20
                      Port    80
                      Priority 5
                  End
                  BackEnd
                      Address 192.168.1.21
                      Port    80
                      Priority 4
                  End
                  Session
                      Type    COOKIE
                      ID      "userid"
                      TTL     180
                  End
              End

Скачать скомпилированный Pound под Windows:
pound-2.7.exe.cab

06 06 2016

Spot Assist – приложение для парашютиста

Uchla skydive Parachute 1

ЧТО ЭТО ПРИЛОЖЕНИЕ ДЕЛАЕТ?
Если вы под куполом в области синего цвета, то у вас достаточно высоты, чтобы вернуться и приземлиться по схеме захода / Если вы под куполом в области красного цвета, то у вас может не хватить высоты, чтобы приземлиться по схеме захода или даже вернуться / Выберите свой купол / Выберите, когда раскрыть парашют
Показывается схема захода с учетом актуального ветра / Нажать и изменить высоты поворотов (leg turn) / Выбрать лучшее направление для приземления / Нажать и перетащить точку приземления (цель)
Ветер по высотам, скорость, направление, температура / Быстрое переключение местоположения
В настройках приложения есть переключение на м/с, цельсии и метры.
Ветер, порывы, прогноз температуры / Высота облаков
Добавьте свою дропзону / Дропзоны и погода по всему миру
СОПРОВОЖДЕНИЕ ПОСЛЕ ОТЦЕПКИ
Вы можете рассчитать приблизительное место падения основного купола после отцепки:
cutaway-controls-1
cutaway-result-2
УСТАНОВИТЬ
Приложение доступно для iPhone и Android по следующим ссылкам:

  • Android

    Get it on Google Play

  • iPhone/iPad

    Download on the App Store

В данный момент ведется работа над веб-версией.
www.spotassist.com
#Spot Assist Skydiving Tool

1 2 3 4 5 >»

Neueste Beiträge

  • configure: error: cannot run C compiled programs
  • gcc: get livestream url
  • LoadString (C++ Builder)
  • Neufahrn
  • tectudssr

Recent Comments

  • Ruslan: fastcgi permalinks: change in nginx config: location / { lo…
  • uchla: Добавил в настройках опцию word wrap…
  • KR: Добрый день! Можно в текстовом ф…
  • rooslan: Installing Audacious on OS X 1. Download and install XQuart…
  • Azaha: Hello, I was wondering if its possible to show questions wi…
Netzentrale
© 2003-2021, Ruslan | Alle Rechte vorbehalten