Skip to content

Instantly share code, notes, and snippets.

View loretoparisi's full-sized avatar
🐍
NightShift

Loreto Parisi loretoparisi

🐍
NightShift
View GitHub Profile
@loretoparisi
loretoparisi / awk_colums_substring.sh
Created January 10, 2018 11:00
AWK Print Columns by Range and Column Substring
awk -F"," 'BEGIN { OFS="" ; ORS="" } ; { for (i=1; i<9; i++ ) print $i ","; print substr($NF,0,20) "\n"}' file.csv
@usmansbk
usmansbk / stripJSON.js
Last active April 22, 2021 15:32
Recursively remove json keys in an array
/**
* @function stripJSON
* @desc - This function removes selected object keys
* @param {Object} json - JavaScript object to strip
* @param {Object[]} keys - array of selected keys (string)
* @return {Object} - deep copy of object without keys
*/
function stripJSON(json, keys) {
if (json === null || json === undefined) return json;
let obj = {}, key;
@kiki67100
kiki67100 / docker-x11.bash
Created December 14, 2017 09:10
Docker macOS X11 display
### Script to install xquartz and set the DISPLAY variable correctly, find the listen port and add current ip to connect to X11.
#skip if you want, install xquartz
brew cask reinstall xquartz
#get ip
IP=$(ifconfig|grep -E inet.*broad|awk '{ print $2; }')
#open XQuartz
open -a XQuartz &
#Go to preference Security check allow network, restart :
read -p "Go to preference Security check allow network and press a key to continue"
@loretoparisi
loretoparisi / map_reduce.js
Last active November 15, 2017 09:14
Map Reduce in Javascript
var survey=[["Active","Chill Out","Cozy","Dancebale","Dark","Energetic","Feel Good","Funky","Happy","Motivating","Party","Warm","Youthful","Athletic","Dramatic","Joyous","Provocative","Rowdy","Spicy","Stylish","Sweet","Aggressive","Atmospheric","Gloomy","Introspective","Sprightly","Seductive","Sensual","Groovy","Sweet","Hypnotic","Optimistic","Active"],["Driving","Happy","Motivating","Warm","Cosmopolitan","Dramatic","Joyous","Provocative","Stylish","Aggressive","Angry","Gloomy","Introspective","Melancholic","Intimate","Optimistic","Reflective","Romantic","Sophisticated","Thrilling","Celebratory","Exciting","Erotic","Enigmatic","Exotic","Ironic","Irreverent","Apocalyptic","Funereal","Austere","Dreamy","Declamatory","Nostalgic","Passionate","Tragic","Trashy","Heroic","Majestic","Naive","Powerful","Mystical","Cheerful","Rebellious"],["Dark","Feel Good","Happy","Motivating","Youthful","Bravado","Dramatic","Joyous","Provocative","Triumphant","Aggressive","Angry","Introspective","Melancholic","Intimate","Optimistic
<?php
/*
Plugin Name: Custom Registration Fields
Plugin URI:
Description:
Version: 0.1
Author: CSSIgniter
Author URI:
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@xor-gate
xor-gate / sshclient.go
Created October 18, 2017 22:00 — forked from josephspurrier/sshclient.go
Golang SSH Client
package main
import (
"bufio"
"io/ioutil"
"os/signal"
//"syscall"
"fmt"
"log"
"os"
@loretoparisi
loretoparisi / bookmarklet.js
Created October 18, 2017 21:59
Create a bookmarklet from JavaSscript code
function minify(code) {
// very simple minification (and not overly aggressive on whitespace)
code = code.split(/\r\n|\r|\n/g);
var i=0, len=code.length, noSemiColon = {}, t, lastChar;
$.each('} { ; ,'.split(' '), function(i, x) {
noSemiColon[x] = 1;
});
for (; i<len; i++) {
@loretoparisi
loretoparisi / react_bookmarklet.js
Created October 18, 2017 21:52
React DOM Bookmarklet Code Injection
javascript:(function()%7Bvar%20injc%3Dfunction(src%2Ccbk)%20%7B%20var%20script%20%3D%20document.createElement('script')%3Bscript.src%20%3D%20src%3Bdocument.getElementsByTagName('head')%5B0%5D.appendChild(script)%3Bscript.onload%3Dfunction()%7Bcbk%3Fcbk()%3A''%7D%7D%3Binjc(%22https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2Freact%2F15.1.0%2Freact.min.js%22%2Cfunction()%20%7B%20injc(%22https%3A%2F%2Fcdnjs.cloudflare.com%2Fajax%2Flibs%2Freact%2F15.1.0%2Freact-dom.min.js%22%20)%7D)%7D)()
@loretoparisi
loretoparisi / jquery_bookmarklet.js
Last active July 27, 2022 04:27
Jquery Bookmarklet Code Injection
javascript:(function(){script = document.createElement('script');script.src = "https://ajax.goojavascript:(function()%7Bscript%20%3D%20document.createElement('script')%3Bscript.src%20%3D%20%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.6.3%2Fjquery.min.js%22%3Bdocument.getElementsByTagName('head')%5B0%5D.appendChild(script)%7D)()gleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script);})();
@loretoparisi
loretoparisi / react_inject.js
Created October 18, 2017 21:25
React Code Injection
injc=(src,cbk) => { let script = document.createElement('script');script.src = src;document.getElementsByTagName('head')[0].appendChild(script);script.onload=()=>cbk() }
injc("https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js",() => injc("https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js",() => console.log("ready")))