Skip to content

Instantly share code, notes, and snippets.

View ignaciolg's full-sized avatar

Ignacio Lopez Gomez ignaciolg

View GitHub Profile
@ignaciolg
ignaciolg / nginx_proxy_pass_examples
Created June 17, 2014 23:14
Nginx proxy_pass examples
server {
#listening ip:port
listen 0.0.0.0:80 default_server;
#public data path
root /var/www/nginx/public/;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name subdomain.domain;
@ignaciolg
ignaciolg / newfs_msdos examples
Last active September 13, 2016 03:56
newfs_msdos examples
#man page freebsd
#https://www.freebsd.org/cgi/man.cgi?query=newfs_msdos&apropos=0&sektion=0&manpath=FreeBSD+5.2-RELEASE&format=html
#man page macosx
#https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/newfs_msdos.8.html
#FAT 32 Cluster Size 16Kb Volume "NAME"
sudo newfs_msdos -F 32 -c 32 -v NAME /dev/disk1
#FAT 32 Cluster Size 32Kb Volume "NAME"
@ignaciolg
ignaciolg / 0_reuse_code.js
Last active August 29, 2015 14:19
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

Keybase proof

I hereby claim:

  • I am ignaciolg on github.
  • I am nacholg (https://keybase.io/nacholg) on keybase.
  • I have a public key ASA7yYCPacxsszkgZcJEmAp455Qf6teVS8PCdhUvFwpVLAo

To claim this, I am signing this object:

@ignaciolg
ignaciolg / namecheap dyndns from shell
Last active March 11, 2019 00:12
Update a namecheap DNS registry from shell
# Using httpbin.org, and the next links
# https://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-do-i-use-a-browser-to-dynamically-update-the-hosts-ip
# https://www.namecheap.com/support/knowledgebase/article.aspx/595/11/how-to-enable-dynamic-dns-option-for-a-domain
# setup a cron job and that's all
# works on sysnology scheduled task ;D
HOST="REPLACE BY YOUR HOST, LIKE @ OR ANY SUBDOMAIN";
DOMAIN="REPLACE BY YOUR DOMAIN";
PASSWORD="REPLACE BY YOUR PASSWORD";
IP=$(curl -s https://httpbin.org/ip | python -c "import sys, json; print json.load(sys.stdin)['origin'].split(\",\")[0]");
curl "https://dynamicdns.park-your-domain.com/update?host=$HOST&domain=$DOMAIN&password=$PASSWORD&ip=$IP"
@ignaciolg
ignaciolg / Node browser detection userAgent
Last active August 13, 2019 21:39
Check from the server side the user agent of the client and determine what browser is
// only google chrome
const isChrome = (userAgent) => /^.(?!.*samsungbrowser).*chrome(?!.*opr|.*edg|.*Puffin|.*SamsungBrowser|.*YaBrowser|.*miui).*$/i.test(userAgent)
// only safari browser
const isSafari = (userAgent) => /^((?!chrome|android|opios|fxios).)*safari/i.test(userAgent);
// only edge based on chrome
const isEdge = (userAgent) =>/^.*edge?\//i.test(userAgent);
@ignaciolg
ignaciolg / readFile.js
Created April 15, 2020 13:32
Nashorn - Jmeter - Read file
var readEnvConfiguration = function (name) {
var olinkfile = name || 'default';
var data = "";
var chunk;
var FileReader = Java.type("java.io.FileReader");
var fr = new FileReader(olinkfile);
var config;
chunk = fr.read();
while (chunk != -1) {
data += String.fromCharCode(chunk);
@ignaciolg
ignaciolg / update_portainer.sh
Created August 26, 2021 22:06
Update Portainer to latest + add port label for traefik
#!/bin/sh
docker ps | grep -i portainer
CONTAINER=`docker ps | grep -i portainer | awk '{print $1}'`
docker stop $CONTAINER
docker rm $CONTAINER
docker run --label traefik.http.services.Portainer.loadbalancer.server.port=9000 -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
@ignaciolg
ignaciolg / README.md
Created August 30, 2021 20:06 — forked from Informatic/README.md
openlgtv webOS hacking notes

This is just a dump of some interesting undocumented features of webOS (3.8 specifically, on early 2018 4k LG TV) and other development-related tips.

Receiving DIAL/SSDP

Any installed application can receive DIAL start requests by adding "dialAppName": "NAME" in its appInfo.json. YouTube and Netflix apps have some special handling, but they still can be overriden by an unofficial app.

IMPORTANT: official YouTube app has "dialAppName": "youtube". Installed apps are (or rather seem to be) ordered lexicographically based on their IDs - when multiple apps declare the same dialAppName the last one will be the one triggered via DIAL. (com.youtube.adfree < youtube.leanback.v4 < youtube.leanforward)

@ignaciolg
ignaciolg / gist:68e703e5e612a460687076301bfb6b9b
Created September 16, 2021 13:41
rename/normalize files in mac
for i in *; do mv "$i" "$(echo $i|tr "A-Z -" "a-z_")"; done
# for i in *; do <command>; done # execute command for all files in folder
# mv "$i" ... # move the file to the destiny
# "$(echo $i|tr "string" "string")"# execute echo of the file, and pass it to tr to transform the string. the result will be used by mv