Skip to content

Instantly share code, notes, and snippets.

@jonigl
jonigl / Kaltura Player API
Created May 11, 2016 20:25
Also Playlists API
var playerId = 'myEmbedTarget';
kWidget.embed({
'targetId': playerId,
'wid': '_xxx',
'uiconf_id': 'xxxx',
'flashvars': {
'playlistAPI': {
'plugin': true,
'includeInLayout': false,
'autoPlay': true,
@jonigl
jonigl / scrap.php
Created July 26, 2016 20:08
PHP - scrap using xpath
<?php
$curl = curl_init('http://testing-ground.scraping.pro/blocks');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$page = curl_exec($curl);
if(curl_errno($curl)) // check for execution errors
{
echo 'Scraper error: ' . curl_error($curl);
exit;
}
curl_close($curl);
@jonigl
jonigl / simplest-scraper.php
Created July 26, 2016 20:55
Simplest scraper
<?php
$contents = file_get_contents("URL HERE");
$dom = new DOMDocument();
@$dom->loadHTML($contents);
$xpath = new DOMXpath($dom);
$element = trim((string) $xpath->query("XPATH FROM CHROME HERE")->item(0)->nodeValue);
echo $element;
?>
@jonigl
jonigl / bash
Last active September 1, 2018 22:45 — forked from jonashackt/bash
Remote debugging Spring Boot
### java -jar
address = ip:port
address = *:port (* wildcard allow any ip address)
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=*:5005,suspend=y -jar target/cxf-boot-simple-0.0.1-SNAPSHOT.jar
### Maven
Debug Spring Boot app with Maven:
# Require Node.js core modules.
fs = require 'fs'
url = require 'url'
http = require 'http'
querystring = require 'querystring'
#### The Pixel Ping server
# Keep the version number in sync with `package.json`.
VERSION = '0.1.3'
@jonigl
jonigl / ec2volList.py
Created March 10, 2020 01:22 — forked from chemar/ec2volList.py
AWS EC2 list volumes and attributes using boto3
import boto3
ec2 = boto3.resource('ec2')
volume_iterator = ec2.volumes.all()
for v in volume_iterator:
for a in v.attachments:
print "{0} {1} {2}".format(v.id, v.state, a['InstanceId'])
@jonigl
jonigl / cloudSettings
Last active April 27, 2020 14:09
test
{"lastUpload":"2020-04-27T14:09:27.441Z","extensionVersion":"v3.4.3"}
@jonigl
jonigl / github.bash
Created May 15, 2020 16:51 — forked from igrigorik/github.bash
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep git@github.com | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
function FindProxyForURL(url, host) {
PROXY = "PROXY proxy.corp.ipsy.com:80; DIRECT";
hosts = ["*.acloud.guru", "ifconfig.me"];
for (let i = 0; i < hosts.length; i++) {
if (shExpMatch(host, hosts[i])) {
return PROXY;
}
}
return "DIRECT";
}
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?