Skip to content

Instantly share code, notes, and snippets.

View iraniamir's full-sized avatar
💪
Let's Dance

Amir Irani iraniamir

💪
Let's Dance
  • Internet
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://media.rss.com/style.xsl"?>
<rss xmlns:podcast="https://podcastindex.org/namespace/1.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xml:lang="en" version="2.0">
<channel>
<title><![CDATA[سیاره زمین]]></title>
<link>https://feed.ufopersian.ir/planet-earth</link>
<atom:link href="https://feed.ufopersian.ir/planet-earth/rss.xml" rel="self" type="application/rss+xml"/>
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com/"/>
<description><![CDATA[<p>گفتمانی دوستانه پیرامون این سیاره و کهکشان خودمون</p>]]></description>
<generator>RSS.com v2.10.1</generator>
@iraniamir
iraniamir / main.go
Created May 8, 2019 07:42
IPv4 to Mongo ObjectID
package main
import (
"encoding/hex"
"fmt"
"strings"
"gopkg.in/mgo.v2/bson"
)
@iraniamir
iraniamir / main.go
Last active May 1, 2019 03:25
Instagram, show summary email address
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Print(hideEmailAddress("[email protected]"))
@iraniamir
iraniamir / form-validation.jsx
Created October 28, 2018 16:08
React html5 form validation
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { EMLINK } from 'constants';
export default class FormValidation extends Component {
static propTypes = {
children: PropTypes.node,
submit: PropTypes.func.isRequired
};
@iraniamir
iraniamir / server.js
Created September 16, 2018 12:57
CacheRestServer
const express = require('express');
const axios = require('axios');
const cacheAdapter = require('axios-cache-adapter');
const app = express()
const port = 3210
const fetchCache = cacheAdapter.setup({
cache: {
maxAge: 15 * 60 * 1000
}
@iraniamir
iraniamir / index.html
Created August 21, 2018 13:00
Chunk upload file
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Fanap Drive Upload</title>
</head>
<body>
{
"hasError": false,
"referenceNumber": "207899",
"errorCode": 0,
"count": 0,
"ott": "ad341b80f845cd2e",
"result": {
"id": 132,
"hash": "M9XRVIRGBQEQW5BW",
"ownerId": 0,
@iraniamir
iraniamir / gist:542efea7984bbcb3ccc2315f1d36f46e
Last active February 9, 2018 11:58
Serving any spa on apache2
DirectoryIndex /application/index.html
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /application/index.html [L]
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>
@iraniamir
iraniamir / gist:58460372cf2e4c54fc7679a614b114cb
Created January 29, 2018 22:09
Block all countries except IRAN for linux servers in iptables with geoip
iptables -A INPUT -m geoip --src-cc A1 -j DROP &&
iptables -A INPUT -m geoip --src-cc A2 -j DROP &&
iptables -A INPUT -m geoip --src-cc AD -j DROP &&
iptables -A INPUT -m geoip --src-cc AE -j DROP &&
iptables -A INPUT -m geoip --src-cc AF -j DROP &&
iptables -A INPUT -m geoip --src-cc AG -j DROP &&
iptables -A INPUT -m geoip --src-cc AI -j DROP &&
iptables -A INPUT -m geoip --src-cc AL -j DROP &&
iptables -A INPUT -m geoip --src-cc AM -j DROP &&
iptables -A INPUT -m geoip --src-cc AO -j DROP &&
@iraniamir
iraniamir / preview-form.jsx
Created January 28, 2018 08:31
Mithril Bootstrap Forms
import m from "mithril";
module.exports = (options, ...elements) => {
return (
<form {...options.attrs} class="form needs-validation">
{
elements.map(e => {