Skip to content

Instantly share code, notes, and snippets.

@SimonGivre
SimonGivre / putIO-convert-to-MP4.js
Created August 30, 2012 09:47
put.io JS to convert into MP4 every file of folder
console.log($('.filelist .file-name .ftype:contains(video)').length + ' files to convert');
var cpt=0;
$('.filelist .file-name .ftype:contains(video)').each(function(){
var row = $(this).prev();
var id = row.attr('href').substring(row.attr('href').lastIndexOf('/')+1);
$.post('/v2/files/'+id+'/mp4',function(data){
console.log(data.status);
if(data.status=="OK") cpt++;
});
});
@SimonGivre
SimonGivre / test-country-IP-addresses.txt
Created August 30, 2012 10:21
Test country IP addresses
# IPs
Spain 62.13.255.230 2.20.185.5
Germany 2.16.6.5
Australia 1.2.3.4
USA 65.98.56.219
UAE 80.190.204.129
Italy 87.23.255.254
French 62.129.191.252
UK 91.151.7.6
CZ 62.4.96.5
@SimonGivre
SimonGivre / BeanListToPropertyValueList.java
Created September 3, 2012 02:28
Transform List of Bean into list of Bean's property values
import org.apache.commons.beanutils.BeanToPropertyValueTransformer;
import org.apache.commons.collections.CollectionUtils;
Collection<Long> userIds = (Collection<Long>) CollectionUtils.collect(users, new BeanToPropertyValueTransformer("id"));
@SimonGivre
SimonGivre / tail.js
Created September 18, 2012 02:38
JS tail server logs
var jq = document.createElement('script');
jq.src = "http://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
function tail(){
$.get(window.location.href+'?'+new Date().getTime(),function(data){
var $newPre = $('<pre></pre>');
var logArray = data.split('\n');
var lineCount = logArray.length;
$newPre.append('Line count='+lineCount+'\n');
var tail = "";
@SimonGivre
SimonGivre / webcamfun.js
Created October 4, 2012 23:22
JS Webcam fun
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || undefined;
navigator.getUserMedia({video: true}, function (stream) {
window.webcamSwiperStream = stream;
var videoElement = document.createElement("video");
videoElement.autoplay = true;
document.getElementsByTagName("body")[0].appendChild(videoElement);
if (window.URL === undefined) {
window.URL = window.webkitURL;
}
videoElement.src = window.URL.createObjectURL(stream);
@SimonGivre
SimonGivre / gist:5442412
Created April 23, 2013 10:17
nmap powa
nmap -Pn -sS -F -T4 -O -sV --script "default and safe" --open <host>
@SimonGivre
SimonGivre / gist:7805379
Created December 5, 2013 13:47
post.js
var jq = document.createElement('script');
jq.src = "http://code.jquery.com/jquery-latest.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
$.post('http://10.30.1.43:7101/loyapps/smsnthmobile',{ keyword: "LOYFEIGFR",msisdn: "0041792476880", sessionId: "234234",businessNumber:"9292" },function(data){
console.log(data);
});
@SimonGivre
SimonGivre / gist:8666926
Last active January 4, 2016 19:19
print JIRA Done Issues Ids
function printJIRADoneIssuesIds(){
var $doneCol = $($('.ghx-column')[$('.ghx-column').length-1]);
var $issues = $($doneCol.find('.ghx-key-link.js-detailview'));
console.log('Contains '+$issues.length+' done issues');
var result = "";
$issues.each(function(i,val){
result+=$(val).attr('title')+' ';
});
console.log('Ids:');
console.log(result);
@SimonGivre
SimonGivre / gist:8689670
Last active May 15, 2018 14:57
Swiss Holidays
// to be executed on http://www.feiertagskalender.ch/
var year = 2019;
var hidepast = 0; // hide past values or not
var type = 3; // 3 = Legally recognized holidays ; 4 = Legally + not recognized holidays
var geos = {
"Aargau": 1,
"Appenzell Innerrhodes": 266,
"Appenzell Ausserrhoden": 245,
"Bern": 369,
@SimonGivre
SimonGivre / recu_inspect_archives.sh
Last active April 18, 2019 11:44 — forked from tyrcho/recunzip.sh
recursively unzip jar, war, ear files
#inspired by http://unix.stackexchange.com/questions/4367/extracting-nested-zip-files
while [ "`find . -type f -name '*.?ar' | wc -l`" -gt 0 ]; do
find -type f -name "*.?ar" \
-exec mkdir -p '{}.dir' \; \
-exec unzip -o -d '{}.dir' '{}' \; \
-exec rm -- '{}' \;
done