Skip to content

Instantly share code, notes, and snippets.

gleero

Block or report user

Report or block gleero

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mssh
#!/usr/bin/perl
$iport = int(rand(40000)) + 10000;
$first = 1;
foreach (@ARGV) {
if (/^-/) {
$args .= " $_";
}
elsif (/^((.+)@)?([^:]+):?(\d+)?$/) {
@gleero
gleero / uart.sh
Created Jan 30, 2019
Mac UART command
View uart.sh
#!/bin/bash
echo "Waiting for the UART..."
while true; do
SERIAL="$(ls /dev/tty* | grep usbserial)"
if [ -n "$SERIAL" ]; then
screen "$SERIAL" 115200
fi
sleep 1
done
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Yoba</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@gleero
gleero / gist:5ac2b3340cf0194209ce
Created Oct 8, 2014
Чистка и реиндекс
View gist:5ac2b3340cf0194209ce
for f in *.db; do sqlite3 $f "VACUUM; REINDEX;"; done
View gist:10665416
#!/bin/bash
#################################
str="Привет, наркомания"
#################################
# Карта цветов
len=`echo $str | wc -c`
View gist:8978658
from gi.repository import GLib, Gio, GObject
import time
def slow_stuff(job, cancellable, user_data):
print "Slow!"
for i in xrange(5):
print "doing slow stuff..."
time.sleep(0.5)
print "finished doing slow stuff!"
return False # job completed
@gleero
gleero / gist:7562662
Created Nov 20, 2013
Файл: ~/dotfiles/private/bash_profile.sh Либо можно скопировать это добро напрямую в ~/.bash_profile или в ~/.bashrc
View gist:7562662
# Private Bash Profile
# Can be used for other settings you don’t want to commit
echo ""
echo "$YELLOW Hostname$NOCOLOR: $WHITE`hostname`$NOCOLOR"
echo "$YELLOW Inet IP$NOCOLOR: $WHITE`ip`$NOCOLOR"
echo "$YELLOW Local IP$NOCOLOR: $WHITE`localip`$NOCOLOR"
echo "$YELLOW Uptime$NOCOLOR: $WHITE`uptime | awk -F 'up ' '{ print $2 }' | awk -F ',' '{ print $1 }'`$NOCOLOR"
echo "$YELLOW SSD usage$NOCOLOR: $WHITE`df / | awk '{print $5}' | grep "%"`$NOCOLOR"
echo "$YELLOW HDD usage$NOCOLOR: $WHITE`df /Volumes/HDD | awk '{print $5}' | grep "%"`$NOCOLOR"
View gist:7456463
#!/bin/bash
if echo "$1" | grep ":" > /dev/null; then
srv="`echo \"$1\" | awk -F\: '{ print \$1}'`"
pth="`echo \"$1\" | awk -F\: '{ print \$2}'`"
cmd="cd $pth;"
else
srv="$1"
fi
cmd="$cmd cat | bash"
cat $2 | ssh "$srv" "$cmd"
You can’t perform that action at this time.