Skip to content

Instantly share code, notes, and snippets.

Alexandre Bolelli semeion

Block or report user

Report or block semeion

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maxcnunes
maxcnunes / curl-get-status-code-and-response-body.sh
Created Nov 24, 2015
Curl - Get status code and response body
View curl-get-status-code-and-response-body.sh
URL="http://stackoverflow.com/"
# store the whole response with the status at the and
HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)
# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
View _Example polkit rules_.md

These are only examples, for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the polkit(8) manpage for the object structure and available API. These examples are for polkit versions 106 and later, with the JS interpreter. They won't work with Debian's polkit v105.

  • If you don't know the action name, run pkaction:

    pkaction | grep cups
    
  • The possible results are YES, AUTH_SELF(_KEEP), AUTH_ADMIN(_KEEP), NO. Returning a result is final. Returning null will continue checking other rules.

  • Put your rules in /etc/polkit-1/rules.d/*.rules. (You can check everything in one giant addRule, or you can have a separate file and separate addRule for each program; it doesn't matter.)

@jkstill
jkstill / proc_net_tcp_decode
Last active Oct 31, 2019
decode entries in /proc/net/tcp
View proc_net_tcp_decode
Decoding the data in /proc/net/tcp:
Linux 5.x /proc/net/tcp
Linux 6.x /proc/PID/net/tcp
Given a socket:
$ ls -l /proc/24784/fd/11
lrwx------ 1 jkstill dba 64 Dec 4 16:22 /proc/24784/fd/11 -> socket:[15907701]
@joemiller
joemiller / netpps.sh
Created Nov 14, 2012
shell: quick linux scripts for showing network bandwidth or packets-per-second
View netpps.sh
#!/bin/bash
if [ -z "$1" ]; then
echo
echo usage: $0 network-interface
echo
echo e.g. $0 eth0
echo
echo shows packets-per-second
View VLC-Live-Transcoding.md

Live Transcoding

This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.

Documentation links

@deanet
deanet / google.sh
Created Aug 22, 2012
Uploading File into Google Drive (because grive too many dependencies qt, xorg ? )
View google.sh
#!/bin/bash
## uploading to google
## rev: 22 Aug 2012 16:07
det=`date +%F`
browser="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0.1"
username="user@domain-apps.com"
password="password"
accountype="HOSTED" #gooApps = HOSTED , gmail=GOOGLE
@james2doyle
james2doyle / curl-smtp-email.sh
Last active Aug 19, 2019
Send SMTP email using cURL
View curl-smtp-email.sh
curl --connect-timeout 15 -v --insecure "smtp://smtp.example.com:25" -u "username:password"
\ --mail-from "sender@example.com" --mail-rcpt "destination@example.com"
\ -T email-contents.txt --ssl
@markusfisch
markusfisch / upnp.sh
Last active Jun 29, 2019
bash script to send a UPnP message
View upnp.sh
#!/usr/bin/env bash
# Send UPnP message
#
# @param 1 - host:port/query (optional when UPNP_URL is set)
# @param 2 - service#action (optional when UPNP_ACTION is set)
# @param 3 - message arguments in XML format (optional)
upnp_send()
{
# prefer arguments over presets
@akostadinov
akostadinov / xmr-stak.service
Last active Jun 24, 2019
Example xmr-stak systemd service unit file.
View xmr-stak.service
[Unit]
Description=xmr-stak miner
After=syslog.target network.target
[Service]
Type=simple
# interesting info about starting as regular user: https://bbs.archlinux.org/viewtopic.php?id=162297
User=username
LimitMEMLOCK=256M
EnvironmentFile=-/etc/sysconfig/xmr-stak
@yeokm1
yeokm1 / Read-only FS on Arch Linux ARM.md
Last active Jun 6, 2019
Set up Arch Linux ARM on Raspberry Pi to boot from and use a read-only file-system
View Read-only FS on Arch Linux ARM.md

Read-only FS on Arch Linux ARM

Unlike your typical computer where you usually shutdown properly, I cannot rely on this during the use of my Raspberry Pi. If the Raspberry Pi is improperly shutdown too many times, data corruption in the file system leading to unbootable SD card may result. So we should use a read-only file system.

Full instructions and explanations are obtained from this link but you can run these commands directly. I modified some of the instructions for personal convenience.

Login with default username: alarm, password: alarm

#Optionally enable root over SSH. The rest of these instructions assume u are in root.
You can’t perform that action at this time.