Skip to content

Instantly share code, notes, and snippets.

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

Kenn trappedinspacetime

🏠
Working from home
  • For Personal Use
  • Istanbul
View GitHub Profile
@trappedinspacetime
trappedinspacetime / 0_reuse_code.js
Created November 5, 2015 12:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
view = new QWebView(this);
QPalette palette = view->palette();
palette.setBrush(QPalette::Base, Qt::transparent);
view->page()->setPalette(palette);
view->setAttribute(Qt::WA_OpaquePaintEvent, false);
@trappedinspacetime
trappedinspacetime / DIDL-Lite
Created October 22, 2017 20:04 — forked from probonopd/DIDL-Lite
Play a YouTube video on a Samsung Smart TV using UPNP
<?xml version="1.0" encoding="UTF-8"?>
<DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sec="http://www.sec.co.kr/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/">
<item id="f-0" parentID="0" restricted="0">
<dc:title>Video</dc:title>
<dc:creator>vGet</dc:creator>
<upnp:class>object.item.videoItem</upnp:class>
<res protocolInfo="http-get:*:video/mp4:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000" sec:URIType="public">$URI</res>
</item>
</DIDL-Lite>
@trappedinspacetime
trappedinspacetime / replace.sh
Created November 24, 2017 11:00 — forked from hlissner/replace.sh
Bulk search & replace with ag (the_silver_searcher)
# ag <https://github.com/ggreer/the_silver_searcher>
# usage: ag-replace.sh [search] [replace]
# caveats: will choke if either arguments contain a forward slash
# notes: will back up changed files to *.bak files
ag -0 -l $1 | xargs -0 perl -pi.bak -e "s/$1/$2/g"
# or if you prefer sed's regex syntax:
ag -0 -l $1 | xargs -0 sed -ri.bak -e "s/$1/$2/g"
@trappedinspacetime
trappedinspacetime / stream_to_youtube.sh
Created November 30, 2017 12:22 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">
<IRCCCode>AAAAAgAAAJcAAAAZAw==</IRCCCode>
</u:X_SendIRCC>
</s:Body>
</s:Envelope>
@trappedinspacetime
trappedinspacetime / Commands.xml
Created December 14, 2017 17:01 — forked from joshluongo/Commands.xml
Sony BRAVIA KDL-55EX720 Remote Commands
<?xml version="1.0"?>
<remoteCommandList>
<command name="Confirm" type="ircc" value="AAAAAQAAAAEAAABlAw=="/>
<command name="Up" type="ircc" value="AAAAAQAAAAEAAAB0Aw=="/>
<command name="Down" type="ircc" value="AAAAAQAAAAEAAAB1Aw=="/>
<command name="Right" type="ircc" value="AAAAAQAAAAEAAAAzAw=="/>
<command name="Left" type="ircc" value="AAAAAQAAAAEAAAA0Aw=="/>
<command name="Home" type="ircc" value="AAAAAQAAAAEAAABgAw=="/>
<command name="Options" type="ircc" value="AAAAAgAAAJcAAAA2Aw=="/>
<command name="Return" type="ircc" value="AAAAAgAAAJcAAAAjAw=="/>
@trappedinspacetime
trappedinspacetime / build_cross_gcc
Created January 29, 2018 20:00 — forked from preshing/build_cross_gcc
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
@trappedinspacetime
trappedinspacetime / web-servers.md
Created February 11, 2018 12:47 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@trappedinspacetime
trappedinspacetime / translate.sh
Created February 24, 2018 15:56
Translate vala project (including appdata.xml and .desktop files) with Gettext and bash script
#!/bin/bash
# Script for easy developing by Carlos Suárez ([email protected]) - 2018
# Define variables
PACKAGE="myapplication"
TEMPLATE=po/$PACKAGE.pot
FILES=po/*.po
# Search strings to translate and update po files (mark with _ translatable fields in appdata file)
# p.ex.: <_li>My Application do something</_li><_li>Also do something more</_li>
# Don't use _ to <name> and <summary>.
MYVAR=$(find . -type f -name *vala -or -name *appdata.xml.in -or -name *desktop.in)