Skip to content

Instantly share code, notes, and snippets.

View matinrco's full-sized avatar
Thinkering... 😁

Matin matinrco

Thinkering... 😁
View GitHub Profile
matinrco /
Created August 30, 2017 10:00
Delete old log files in /var/log
sudo find /var/log -type f -regex ".*\.gz$" -delete
sudo find /var/log -type f -regex ".*\.[0-9]$" -delete
matinrco /
Last active January 25, 2018 17:06
Let’s Encrypt - issue certificates with certbot-auto and renew how to
#this file is not ready for execution
#go to /opt to download certbot-auto
cd /opt
#correct permissions
chmod a+x certbot-auto
matinrco / toBase64.js
Last active July 14, 2023 16:11
Convert any file to base64 in javascript
var toBase64=function (file , callBack) {
var reader = new FileReader();
reader.onload = function () {
reader.onerror = function (error) {
console.log('Error: ', error);
matinrco / DragAndDrop.js
Created October 9, 2017 10:14
use jQuery drag and drop
'drop dragdrop':function(event){
console.log('drag enter')
matinrco /
Created October 27, 2017 10:20
This script will run Robo 3T (robomongo) with MongoDB and then it will close MongoDB if you close robo 3t
#mongodb data directory - change this to your desired location - and check for write permissions
#create directories if not exist
mkdir -p "$DIRECTORY/data"
mkdir -p "$DIRECTORY/log"
#create empty log file if not exist
matinrco / preventDebouncing.js
Created October 27, 2017 19:50
Prevent click debouncing in react native
export function throttle(func, wait, ctx, immediate = true) {
let timeoutRefId;
let args;
let context;
let timestamp;
let result;
const later = () => {
const last = timestampNow() - timestamp;
matinrco / DisableSameOriginPolicyOnChrome.txt
Created December 3, 2017 12:21
Disable same origin policy on google chrome
Run chrome with these flags :
--disable-web-security --user-data-dir
* Windows
* In windows create google chrome shortcut somewhere & add these flags to the end of target field then relaunch it from this shortcut
* tested on chrome 62
* "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir
* Linux
* In linux it's Ez, just run it !
matinrco /
Last active December 6, 2017 10:55
Chain ssh by ProxyCommand and Netcat

I have windows machine in corporate which has vpn connection to access multiple servers. But I want to acccess servers from my home computer.

So I installed openssh server from here on windows machine. Download or file . (version tested)

Extract the package in C:\Program Files\OpenSSH . As the Administrator, install SSHD and ssh-agent services

powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
@media screen and (min-width: 1200px) {
@media screen and (min-width: 992px) and (max-width: 1199px) {
@media screen and (min-width: 768px) and (max-width: 991px) {
@media screen and (min-width: 576px) and (max-width: 767px) {
matinrco / MeteorRESTEndpoint.js
Created February 13, 2018 13:58
Create restful API in meteor
import Fiber from 'fibers';
import bodyParser from 'body-parser'
if (Meteor.isServer) {
.use('/getUserProfile', function(req, res, next) {