Skip to content

Instantly share code, notes, and snippets.

View melalj's full-sized avatar

Simo Elalj melalj

View GitHub Profile
@melalj
melalj / save-clip.sh
Created February 4, 2024 18:26
Screen grab any items with its context to Notion. Linked to the Notion template: http://go.tonoid.com/saved-clips-notion-template
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Save Clip
# @raycast.mode silent
# @raycast.packageName Screen grab any items with its context to Notion
#
# Optional parameters:

Keybase proof

I hereby claim:

  • I am melalj on github.
  • I am melalj (https://keybase.io/melalj) on keybase.
  • I have a public key whose fingerprint is BFE6 24E0 133E 351D 468B D193 1CA8 C309 E89F D978

To claim this, I am signing this object:

@melalj
melalj / circleToBezier.js
Created June 30, 2018 21:32
Convert a Circle shape to a set of Bezier curves (SVG Path string) using Javascript
export default function circleToBezier(cx, cy, r) {
// Inspired by https://codereview.stackexchange.com/questions/141491/calculating-a-circle-with-bezier-curves
function Coord(x, y) {
var self = this;
this.x = parseFloat(x);
this.y = parseFloat(y);
this.offset = function(offsetX, offsetY) {
@melalj
melalj / cloudflare_firewall.sh
Created January 6, 2017 21:58
Insert in batch firewall rules to Cloudflare Raw
iplist=("104.155.110.139" "104.155.77.122" "107.21.113.149" "107.21.247.114" "146.148.119.250" "146.148.41.163" "146.148.59.114" "23.251.144.62" "54.232.81.104" "54.232.88.155" "54.232.88.172" "54.235.161.191" "54.244.253.127" "54.245.81.104" "54.245.81.193" "54.251.48.52" "54.251.48.53" "54.251.48.56")
for ip in "${iplist[@]}"
do
echo "\n$ip\n"
curl -X POST "https://api.cloudflare.com/client/v4/zones/xxxxxxxxxxx/firewall/access_rules/rules" \
-H "X-Auth-Email: user@example.com" \
-H "X-Auth-Key: xxxxxxxxxxx" \
-H "Content-Type: application/json" \
function extendRecursive() {
const dst = {};
let src;
const args = [].splice.call(arguments, 0);
const toString = ({}).toString;
while (args.length > 0) {
src = args.splice(0, 1)[0];
if (toString.call(src) === '[object Object]') {
Object.keys(src).forEach(p => {
@melalj
melalj / .block
Last active December 21, 2016 18:25
MapTable: Heatmap visualization (SVG + Canvas) exportable
license: MIT
height: 900
scrolling: yes
@melalj
melalj / invalidate_cloudfront.sh
Created June 7, 2016 23:56
Shell command to Invalidate Cloudfront assets
#!/bin/bash
AWSACCESS="AWSACCESS"
AWSSECRET="AWSSECRET"
DISTRIBUTION_ID="DISTRIBUTION_ID"
PATH="/path_to_invalidate"
AWSDATE=`/usr/bin/php -r "echo gmdate('D, d M Y G:i:s T');"`
AWSSIG=`/usr/bin/php -r "echo base64_encode(hash_hmac('sha1', '$AWSDATE', '$AWSSECRET', true));"`
EPOCH=`/usr/bin/php -r "echo gmdate('U');"`
@melalj
melalj / .block
Last active March 25, 2016 23:56
MapTable: Global Airport by Countries - +6000 rows, Log scale for country colors, tooltip
license: MIT
height: 900
scrolling: yes
@melalj
melalj / .block
Last active March 25, 2016 23:56
MapTable: Basic Map - custom markers
license: MIT
height: 900
scrolling: yes
@melalj
melalj / .block
Last active March 25, 2016 23:55
MapTable: Global Airport Markers with filters - +6000 rows, markers grouped by city, tooltip
license: MIT
height: 900
scrolling: yes