Skip to content

Instantly share code, notes, and snippets.

View AttilaSATAN's full-sized avatar
🏠
Working from home

Attila Satan AttilaSATAN

🏠
Working from home
  • LTVPlus
  • Ankara, Turkey, Earth, Sol, Milkyway
View GitHub Profile
const fs = require('fs');
const http = require('http');
const WebSocket = require('ws');
const child_process = require('child_process');
const WSPORT = 8082;
const CAM1URI = 'rtsp://78.186.127.222:554/11';
const CAM2URI = 'rtsp://78.186.127.222:555/11';
const CAM3URI = 'rtsp://78.186.127.222:556/11';
const ARGS = ['-rtsp_transport', 'tcp', '-i', 'rtsp://78.186.127.222:555/11', '-f',
'mpegts', '-codec:v', 'mpeg1video', '-s', '640x480', '-b:v', '1000k', '-bf', '0', '-'
@AttilaSATAN
AttilaSATAN / arch-linux-install
Created March 24, 2017 15:30 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
Diagnosing Shutdown Problems
Just like with boot problems, when you encounter a hang during shutting down, make sure you wait at least 5 minutes to distinguish a permanent hang from a broken service that's just timing out. Then it's worth testing whether the system reacts to CTRL+ALT+DEL in any way.
If shutdown (whether it be to reboot or power-off) of your system gets stuck, first test if the kernel itself is able to reboot or power-off the machine forcedly using one of these commands:
sync && reboot -f
sync && poweroff -f
If either one of the commands does not work, it is a kernel bug, not systemd.
@AttilaSATAN
AttilaSATAN / site.com.nginx.conf
Created October 18, 2016 09:46
For redirecting every request to SSL and WWW. Using php-fpm.
server {
listen 80;
server_name site.com www.site.com;
return 301 https://www.site.com$request_uri;
}
server {
listen 443;
listen [::]:443;
https://trac.nginx.org/nginx/ticket/496#ticket
@AttilaSATAN
AttilaSATAN / server.js
Created November 27, 2014 09:05
oi termination signals
['SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT', 'SIGBUS', 'SIGFPE', 'SIGUSR1', 'SIGSEGV', 'SIGUSR2', 'SIGPIPE', 'SIGTERM'].forEach(terminatorSetup);
@AttilaSATAN
AttilaSATAN / server.js
Created November 27, 2014 09:03
CORS headers
// // Website you wish to allow to connect
// res.setHeader('Access-Control-Allow-Origin', 'http://localhost:3005');
//
// // Request methods you wish to allow
// res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, DELETE');
//
// // Request headers you wish to allow
// res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type,Authorization');
//
// // Set to true if you need the website to include cookies in the requests sent
@AttilaSATAN
AttilaSATAN / README.md
Created November 19, 2014 12:54
python version switch

For me it got fixed by replacing python2.7 by python2.6. As per https://code.google.com/p/gyp/source/browse/trunk/DEPS#19 , it seems that gyp depends on python 2.6

On Ubuntu Saucy:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.6
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10