Skip to content

Instantly share code, notes, and snippets.

View arashrasoulzadeh's full-sized avatar
👨‍💻
Coder

Arash Rasoulzadeh arashrasoulzadeh

👨‍💻
Coder
View GitHub Profile
@arashrasoulzadeh
arashrasoulzadeh / hantana - arand
Created August 9, 2021 08:03
hantana - arand
<!--Start hantana.org Widget--><script type="text/javascript" defer>!(function (d, w, u, t, s, i) { w.addEventListener('readystatechange', function () { if (w.readyState === "interactive") i = document.documentElement.scrollTop }); function ha() { s = w.createElement("script"); d._hantanaSettings = { tId: t, i: i }; s.type = "text/javascript", s.async = !0, s.src = u + t; h = w.getElementsByTagName('head')[0]; h.appendChild(s); } "complete" === w.readyState ? ha() : d.attachEvent ? d.attachEvent("onload", ha) : d.addEventListener("load", ha, !1); })(window, document, 'https://hantana.org/widget/', '6110d-a8c28-6a771-bf503', 0);</script><!--End hantana.org Widget-->
number=100
def odd(n):
return n % 2 != 0
def calc(n):
print(n)
if odd(n):
n=(n*3)+1
else:
n=n/2
import os
import zipfile
import logging
import boto3
from botocore.exceptions import ClientError
import datetime
# archive the file
current_date = datetime.datetime.now()
@arashrasoulzadeh
arashrasoulzadeh / sublime
Created February 21, 2021 09:06
sublime
1
import requests
import json
cookies = {'PHPSESSID': 'YOUR_SESS_ID_FROM_WEBSITE'}
def sort_by_values_len(dict):
dict_len = {key: len(value) for key, value in dict.items()}
import operator
sorted_key_list = sorted(
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd!
autocmd VimEnter * PlugInstall
endif
call plug#begin('~/.config/nvim/plugged')
Plug 'SirVer/ultisnips' | Plug 'phux/vim-snippets'
call plug#end()
@arashrasoulzadeh
arashrasoulzadeh / goh-packet-sniff.go
Created September 25, 2020 11:11
Go Packet Sniffer
package main
import (
"fmt"
"log"
"time"
"github.com/google/gopacket"
"github.com/google/gopacket/layers"
"github.com/google/gopacket/pcap"

Keybase proof

I hereby claim:

  • I am arashrasoulzadeh on github.
  • I am arashrasoulzadeh (https://keybase.io/arashrasoulzadeh) on keybase.
  • I have a public key whose fingerprint is 3D13 C992 8613 EF60 2570 DE44 2A0F A338 ED97 3F1F

To claim this, I am signing this object:

#include <iostream>
#include <regex>
void processFirstLine(char *string);
using namespace std;
const std::regex ERROR_FILENAME_REGEX("\\w+\\.php on line \\d+");
const std::regex ERROR_LINE_REGEX("\\[\\d+-\\d+-\\d+ \\d+:\\d+:\\d+\\]",
std::regex_constants::ECMAScript | std::regex_constants::icase);
const char *FILENAME = larave_log_location;
@arashrasoulzadeh
arashrasoulzadeh / performance schema sql statistics
Created May 26, 2020 09:29
performance schema sql statistics
select DIGEST_TEXT AS query , COUNT_STAR as exec_count,
SEC_TO_TIME(SUM_TIMER_WAIT/1000000000000) as exec_time_total,
SEC_TO_TIME(MAX_TIMER_WAIT/1000000000000) as exec_time_max,
(AVG_TIMER_WAIT/1000000000) as exec_time_avg_ms,
SUM_ROWS_SENT as rows_sent,
SUM_ROWS_EXAMINED as rows_scanned
FROM performance_schema.events_statements_summary_by_digest ORDER BY SUM_TIMER_WAIT DESC