Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Display exit status of the command:
# echo $?
echo -n "Enter user name : "
read USR
cut -d: -f1 /etc/passwd | grep "$USR" > /dev/null
OUT=$?
if [ $OUT -eq 0 ];then
echo "User account found!"
std::string HttpServer::getStdoutFromCmd(std::string cmd)
{
std::string data;
char buffer[BUFSIZ];
FILE *stream = popen(cmd.c_str(), "r");
while (fgets(buffer, BUFSIZ, stream) != NULL )
data.append(buffer);
#!/bin/sh
## Credits to https://agateau.com/2014/template-for-shell-based-command-line-scripts/
set -e
PROGNAME=$(basename $0)
die() {
echo "$PROGNAME: $*" >&2
exit 1
int main(int argc, char **argv) {
vector<string> args(argv + 1, argv + argc);
string infname, outfname;
// Loop over command-line args
// (Actually I usually use an ordinary integer loop variable and compare
// args[i] instead of *i -- don't tell anyone! ;)
for (vector<string>::iterator i = args.begin(); i != args.end(); ++i) {
if (*i == "-h" || *i == "--help") {
cout << "Syntax: foomatic -i <infile> -o <outfile>" << endl;
#EXTM3U
#EXTINF:-1,Bloomberg (US)
https://liveproduseast.akamaized.net/btv/desktop/us_live.m3u8
#EXTINF:-1,Bloomberg US [720p]
https://liveproduseast.global.ssl.fastly.net/btv/desktop/us_live.m3u8
#EXTINF:-1,Bloomberg (Virginia) [720p]
https://bblive-liveproduseast.hs.llnwd.net/us/Channel-USTV-AWS-virginia-1/Source-USTV-1000-1_live.m3u8
@varvaruc
varvaruc / boost-windows.md
Created December 17, 2018 15:00 — forked from sim642/boost-windows.md
Installing boost libraries for GCC (MinGW) on Windows

Installing boost libraries for GCC (MinGW) on Windows

Folder setup

  1. Extract downloaded boost source, e.g. C:\Program Files\boost_1_59_0.
  2. Create a folder for Boost.Build installation, e.g. C:\Program Files\boost-build.
  3. Create a folder within for building, i.e. C:\Program Files\boost_1_59_0\build.
  4. Create a folder for installation, e.g. C:\Program Files\boost.

GCC setup

  1. Open Command Prompt.
@varvaruc
varvaruc / apns.py
Created March 20, 2014 19:17 — forked from fermion/apns.py
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
/**
* Mock APNS server
*/
var net = require('net');
var HOST='127.0.0.1';
var PORT=7777;
// Need this option so the client doesn't close
// the connection on sending a FIN
/**
* APNS test client
*/
var net = require('net');
var HOST = '127.0.0.1';
var PORT = 7777;
var TOKEN_LENGTH = 64;
var NUM_PACKETS = 5;
"Forget compatibility with Vi. Who cares.
set nocompatible
"for vundle
filetype off
"Write the old file out when switching between files.
set autowrite
"Display current cursor position in lower right corner.