This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import argparse | |
import sys | |
import socket | |
def vsock_server(vsock, args): | |
vsock.listen() | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import socket | |
import struct | |
import fcntl | |
with open("/dev/vsock", "rb") as fd: | |
r = fcntl.ioctl(fd, socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID, " ") | |
cid = struct.unpack("I", r)[0] | |
print("Local CID: {}".format(cid)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shallow clone (the least possible) | |
git clone --depth=1 | |
# clone others depth | |
for d in `seq 1 100`; do echo "depth $d"; git fetch --depth=$d; done | |
# clone all the rest | |
git fetch --unshallow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RED='\033[0;31m' | |
NC='\033[0m' # No Color | |
function usage | |
{ | |
echo -e "usage: $0 [OPTION...]" | |
echo -e "" | |
echo -e "Simple description" | |
echo -e "" | |
echo -e " -s, --set X.Y set parameter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
gst-launch-1.0 -v udpsrc uri=udp://239.1.1.1:5000 caps="application/x-rtp,channels=(int)2,format=(string)S16LE,media=(string)audio,payload=(int)96,clock-rate=(int)44100,encoding-name=(string)L24" ! rtpL24depay ! audioconvert ! autoaudiosink sync=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _dprintk(_fmt, ... )\ | |
do { \ | |
struct timeval _t0; \ | |
do_gettimeofday(&_t0); \ | |
printk(KERN_ERR "%03d.%06d %s():%d - " _fmt "%s\n", \ | |
(int)(_t0.tv_sec % 1000), (int)_t0.tv_usec, \ | |
__func__, __LINE__, __VA_ARGS__); \ | |
} while (0); | |
#define sprintk(...) _dprintk(__VA_ARGS__, "") | |
#ifdef PDEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _DPRINTF(type, _fmt, ... )\ | |
do { \ | |
struct timeval _t0; \ | |
gettimeofday(&_t0, NULL); \ | |
fprintf(stderr, "%03d.%06d %s():%d - %s - " _fmt "%s\n", \ | |
(int)(_t0.tv_sec % 1000), (int)_t0.tv_usec, \ | |
__func__, __LINE__, type , __VA_ARGS__); \ | |
} while (0); | |
#define EPRINTF(...) _DPRINTF("*ERROR*", __VA_ARGS__, "") | |
#define IPRINTF(...) _DPRINTF("INFO", __VA_ARGS__, "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
def sh(cmd, dbg = False): | |
if dbg: | |
print(cmd) | |
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE) | |
ret = process.communicate()[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Remove all remote branches except master | |
REMOTE_NAME="github" | |
MASTER_BRANCH="master" | |
git branch -r | grep ${REMOTE_NAME}/ | grep -v ${MASTER_BRANCH} | grep -v HEAD | cut -d/ -f2-10 | while read line; do git push ${REMOTE_NAME} ${MASTER_BRANCH} :$line; done; |
NewerOlder