Skip to content

Instantly share code, notes, and snippets.

View mariusavram91's full-sized avatar
🚣‍♂️
〰️ 〰️ 〰️ ☁️ 🛰

Marius Avram mariusavram91

🚣‍♂️
〰️ 〰️ 〰️ ☁️ 🛰
View GitHub Profile
@mariusavram91
mariusavram91 / copy_remote_files.py
Last active June 4, 2023 11:14
Copy remote files to local with Python's Paramiko
import os
import paramiko
paramiko.util.log_to_file('/tmp/paramiko.log')
paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
host = 'local'
port = 22
username = 'user'
files = ['file1', 'file2', 'file3', 'file4']
@mariusavram91
mariusavram91 / compare_phpini_files.php
Created January 26, 2016 16:36
Compare two php.ini files
<?php
function conf_to_array($ini_file) {
$phpini = file($ini_file);
$configuration = array();
foreach($phpini as $line) {
if($line[0] == ";") { continue; }
if($line[0] == "[") { continue; }
if(trim($line) == "") { continue; }
$php_var = explode("=", $line);
@mariusavram91
mariusavram91 / check_cap_versions.sh
Last active January 19, 2016 17:57
sh script to check versions for all capistrano stages
#!/bin/sh
#This goes in your devclass/classnew or devclass/classis directory
#To execute it: sh check_cap_versions.sh or ./check_cap_versions.sh,
# if you have +x mode
STAGES=config/deploy
for file in `ls -a $STAGES -I sample.rb -I vagrant.rb -I local.rb -I localhost.rb| grep \.rb$`
do
@mariusavram91
mariusavram91 / websocket_server.rb
Created February 1, 2014 21:35
Websocket server
STDOUT.sync=true
require 'rubygems'
require 'em-websocket'
EM.run {
EM::WebSocket.run(:host => "0.0.0.0",:port => 8080) do |ws|
ws.onopen { |handshake|
puts "WebSocket connection open"
ws.send "Connected"