Skip to content

Instantly share code, notes, and snippets.

View arashm's full-sized avatar
:shipit:

Arash Mousavi arashm

:shipit:
View GitHub Profile
@arashm
arashm / geminfo.rb
Created August 5, 2021 10:45
Fetch gems info from rubygems.org and pretty print it to terminal
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rest-client'
gem 'colorize'
end
@arashm
arashm / Gemfile
Created June 24, 2020 22:51 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@arashm
arashm / client.rb
Created November 15, 2019 16:38
Simple TCP/IP Server that can listen to multiple clients and send messages to all of them
# frozen_string_literal: true
require 'socket'
class Client
def initialize
@socket = TCPSocket.new('localhost', 2000)
end
def next_line
@arashm
arashm / crt_gen.sh
Last active June 23, 2017 18:28
Make self signed SSL certificate
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out certificate.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key certificate.key -out certificate.csr
echo "Removing passphrase from key (for nginx)..."
cp -v certificate.{key,org}
openssl rsa -in certificate.org -out certificate.key
@arashm
arashm / nginx_enable.fish
Created August 27, 2016 15:26
A simple script to change the current enabled config of nginx
function nginx-enable --argument-names config_name -d "enable the given nginx config"
set nginx_conf_path "/etc/nginx"
set available_directory "servers-available"
set enabled_directory "servers-enabled"
if test ! -n "$config_name"
echo "No config is given."
return
end
@arashm
arashm / IranLUGs.md
Last active September 23, 2018 16:51
@arashm
arashm / postgres_queries_and_commands.sql
Created June 26, 2016 15:50 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
set fisher_home ~/.local/share/fisherman
set fisher_config ~/.config/fisherman
set -gx EDITOR vim
set -gx GEM_EDITOR vim
set -gx LESSOPEN "| /usr/bin/src-hilite-lesspipe.sh %s"
set -gx LESS ' -R '
set -gx TERM xterm-256color
set -gx RUST_SRC_PATH $HOME/workspace/NiceProjects/Rust/rust/src
set -gx LANG en_US.utf8
set -gx LC_ALL en_US.utf8
@arashm
arashm / keybase.md
Created October 25, 2014 10:34
keybase.md

Keybase proof

I hereby claim:

  • I am arashm on github.
  • I am thearashm (https://keybase.io/thearashm) on keybase.
  • I have a public key whose fingerprint is A4E0 F08E DCD6 83C7 2C9A DAEE 4BE1 AC21 B6B6 E8FA

To claim this, I am signing this object:

@arashm
arashm / radiojavan.rb
Last active April 22, 2022 20:03
Fetch download links of RadioJavan Playlists
#!/usr/bin/env ruby
# gem install mechanize
require 'mechanize'
abort "Usage:\n\tradiojavan.rb \"https://www.radiojavan.com/playlists/playlist/mp3/02596ef9986a\" output_txt" if ARGV.size < 2
playlist_url = ARGV[0]
output_file = ARGV[1]
HOST = 'https://www.radiojavan.com'