Skip to content

Instantly share code, notes, and snippets.

View xiCO2k's full-sized avatar
🚒
I'm the web plumber!

Francisco Madeira xiCO2k

🚒
I'm the web plumber!
View GitHub Profile
@xiCO2k
xiCO2k / gist:3834170
Created October 4, 2012 15:02 — forked from padolsey/gist:527683
JavaScript: Return ie value
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@xiCO2k
xiCO2k / CSS: IR
Created October 4, 2012 15:07 — forked from attegists/CSS: IR
CSS: IR
.ir {
border:0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@xiCO2k
xiCO2k / nginx-rtmp-stream-multi-debian-18.md
Last active May 30, 2024 01:53
RTMP Server to Stream to Facebook, Youtube, Instagram
apt install nginx
apt install libnginx-mod-rtmp
apt install ffmpeg
apt install stunnel4

vim /etc/nginx/nginx.conf

  • Remove http {} and mail {}
@xiCO2k
xiCO2k / mp3-to-HLS.sh
Created November 14, 2020 22:58
Create HLS version of .mp3 file
#!/bin/sh
for file in *.mp3
do
basename=${file/.mp3/}
mkdir $basename
ffmpeg -y -i "$file" -c:a aac -b:a 128k -muxdelay 0 -f segment -sc_threshold 0 -segment_time 7 -segment_list "$basename/playlist.m3u8" -segment_format mpegts "$basename/%d.m4a"
done
@xiCO2k
xiCO2k / changeDHCPSettings.js
Last active September 19, 2023 11:59
Change IP address to 172.16.0.x on D-Link DWR 920
// Copy from the original funcion on the router.
// The router only allows IPs with 192.168. prefix, and subnet mask 255.255.255.0
// Run on console, and then call applicationApi_dhcpsettingsSet();
function applicationApi_dhcpsettingsSet() {
cpApi_get_authId();
var ip_addr = '172.16.0.200';
var start_addr = '172.16.0.201';
var num = 41;
@xiCO2k
xiCO2k / CustomFormatter.js
Last active September 9, 2021 15:55
vue-i18n CustomFormatter using the laravel replacement logic
// const i18n = new VueI18n({
// formatter: new CustomFormatter(),
// });
export default class CustomFormatter {
interpolate (message, values) {
const capitalize = s => s.charAt(0).toUpperCase() + s.slice(1);
Object.entries(values || []).forEach(([key, value]) => {
value = '' + value;
@xiCO2k
xiCO2k / capitalize.js
Last active September 21, 2021 12:32
Capitalize Helper
const capitalize = str => str.replace(/^\w|\s\w/g, char => char.toUpperCase());
@xiCO2k
xiCO2k / docker-compose.yml
Last active September 25, 2021 22:48
Traefik Docker Example
version: "3.3"
networks:
web:
external: true
services:
traefik:
image: "traefik:v2.5"
container_name: "traefik"
@xiCO2k
xiCO2k / gist:b2c2d980169282b266c1cb44f8fbcd26
Created October 21, 2021 15:12
Telnet command to set Sony A5000 shutter speed to 60
bk.elf w 00030081 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
@xiCO2k
xiCO2k / gist:3e633aeb4a0be3091cf6d0729179bbab
Created October 21, 2021 15:12
Telnet command to set Sony A5000 shutter speed to 60
bk.elf w 00030081 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00