Skip to content

Instantly share code, notes, and snippets.

View hddananjaya's full-sized avatar
⚔️

Akila Dananjaya hddananjaya

⚔️
View GitHub Profile
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
<title>The Vivlio Daily【Sample Edition】第0042号</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<style>
@charset "UTF-8";
html {
gcloud auth application-default login \
--scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/datastore \
--client-id-file=$(ls client_secret_*.json)
@hddananjaya
hddananjaya / extract.js
Created May 8, 2020 17:56
Facebook - Extract group users.
var nodes = document.querySelectorAll('[data-name=GroupProfileGridItem]');
var users = [];
for (i of nodes){
var name = i.children[1].children[1].children[0].children[1].children[0].textContent
var profilePic = i.children[0].children[0].src
users.push({name, profilePic});
}
console.log(users)
# in chrome dev tools we can use copy(object) to copy users.
@hddananjaya
hddananjaya / WeatherReporter.sh
Last active May 8, 2020 06:08
Fidenz bash challenge.
#!/bin/bash
# WeatherReporter 1.0
scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
scriptFile="$scriptDir/$0"
tmpWeatherXMLFile="$scriptDir/sydneyData.xml"
logFile="$scriptDir/weatherReport.log"
tmpCronFile="$scriptDir/cronInfo"
function checkRequiredUtils() {
@hddananjaya
hddananjaya / README._MD
Last active November 13, 2020 01:27
Privacy with GNU Privacy Guard.
gpg2 --symmetric --cipher-algo AES256 -o enc-secrets.zip ./secrets.zip
# remember the password. Never save digitally -
rm -rf ~/.gnupg/
shred --remove secrets.zip
# upload to a cloud service -
shred --remove enc-secrets.zip
@hddananjaya
hddananjaya / CITEXT vs TEXT performance
Last active June 2, 2020 11:40
Postgres CITEXT vs TEXT performance
@hddananjaya
hddananjaya / JS_get_pairs.js
Created December 18, 2019 05:24
Return all combination pairs.
function getPairs(arr){
var pairsList = [];
for (var i=0; i < arr.length - 1; i++){
for (var j=i+1; j < arr.length; j++){
pairsList.push([arr[i], arr[j]]);
}
}
return (pairsList);
}
@hddananjaya
hddananjaya / JS_get_max_arr.js
Created December 16, 2019 06:13
Get max value in an array in JS
return (Math.max.apply(null, arr));
@hddananjaya
hddananjaya / rm_arr.js
Last active December 16, 2019 03:36
JS remove element from a given index.
/* arr - Array
index - int index to remove
*/
function rm_arr (arr, index){
arr.splice(index, 1);
return (arr);
}
@hddananjaya
hddananjaya / curl_read_send.py
Created May 19, 2019 11:09
quick script to read a file and transfer content using curl
# -------------------------------------------------------------
# quick script to read a file and transfer content using curl
# by @_hddananjaya
# -------------------------------------------------------------
import base64
import os
HTTPD = "127.0.0.1:8080"