Skip to content

Instantly share code, notes, and snippets.

@hamzamu
hamzamu / server.js
Created June 21, 2020 17:59
Meteor Picker API: Upload files thru REST API.
import {
WebApp
} from 'meteor/webapp'
import bodyParser from 'body-parser'
const fs = require('fs');
const fse = require('fs-extra')
const path = require('path');
const multer = require('multer');
@hamzamu
hamzamu / simple_rsa
Last active June 21, 2020 18:15 — forked from chj1768/simple_rsa
RSA encryption / decryption example (nodejs) & Meteor
openssl key pair generate
//client - using meteor.js
const nodersa = Npm.require('node-rsa');
import { HTTP } from 'meteor/http';
const syncPost = Meteor.wrapAsync( HTTP.post, HTTP );
encryptStringWithRsaPublicKey( data ) {
const absolutePath = Assets.absoluteFilePath( "public.key" ); //public key file path
const publicKey = fs.readFileSync( absolutePath, "utf8" );
@hamzamu
hamzamu / curl.md
Created June 14, 2020 09:35 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@hamzamu
hamzamu / imap-search
Created June 13, 2020 13:11 — forked from martinrusev/imap-search
IMAP Search criteria
@hamzamu
hamzamu / examples.md
Created April 26, 2020 11:09 — forked from ErisDS/examples.md
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

@hamzamu
hamzamu / addvhost.sh
Created April 22, 2020 22:37 — forked from runbrun/addvhost.sh
bash script to create nginx virtual hosts
#!/usr/bin/env bash
#
# Nginx - new server block
# http://rosehosting.com
read -p "Enter username : " username
read -p "Enter domain name : " domain
# Functions
ok() { echo -e '\e[32m'$domain'\e[m'; } # Green
die() { echo -e '\e[1;31m'$domain'\e[m'; exit 1; }
@hamzamu
hamzamu / client.js
Created April 20, 2020 18:56
Meteor- browser console stats snippet
getStats = function () {
Meteor.call('getStats', null, (err, data) => {
if (data) {
App.setSetting({
stats: data
})
}
})
return "Getting Statistics"
}
@hamzamu
hamzamu / stream_to_youtube.sh
Created March 23, 2020 11:14 — forked from olasd/stream_to_youtube.sh
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
@hamzamu
hamzamu / .block
Created March 19, 2020 11:18 — forked from mbostock/.block
Swiss Cantons
license: gpl-3.0
@hamzamu
hamzamu / countryblock.sh
Created March 18, 2020 08:44 — forked from mombrea/countryblock.sh
Block a list of IP ranges using IPSet and IPTables
#!/bin/bash
#Script to process ip ranges to ban using IPSet and IPTables
ipset create countryblock hash:net
while read line; do ipset add countryblock $line; done < blocklist.txt
iptables -I INPUT -m set --match-set countryblock src -j DROP