Skip to content

Instantly share code, notes, and snippets.

@TheAnonymous
TheAnonymous / form.erb
Last active August 29, 2015 14:14
This is a very simple sinatra webserver to upload/download files. You should create a folder with the name "public" thats where the uploaded files are going. Also please make a folder with the name "views" and place the form.erb there. Thats all have fun :)
<html>
<head>
<title>File Upload</title>
</head>
<body>
<h1>Upload File</h1>
<form action="/save_file" method="POST" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
@TheAnonymous
TheAnonymous / Icon_creator.rb
Created November 15, 2014 15:35
This is a small snippet to change the size of an input image to iconsize of Firefoxphone
require 'opencv'
include OpenCV
if ARGV.size == 0
puts "Usage: ruby #{__FILE__} ImageToLoadAndDisplay"
exit
end
image = nil
begin
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_multisample,
GLX_EXT_create_context_es2_profile, GLX_EXT_import_context,
GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,
name of display: :0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_multisample,
GLX_EXT_create_context_es2_profile, GLX_EXT_import_context,
GLX_EXT_texture_from_pixmap, GLX_EXT_visual_info, GLX_EXT_visual_rating,

Keybase proof

I hereby claim:

  • I am theanonymous on github.
  • I am jakoboesterling (https://keybase.io/jakoboesterling) on keybase.
  • I have a public key whose fingerprint is 4882 0178 448C 2D9C 9F0B D224 EF5F B29F 2E7C 4BAD

To claim this, I am signing this object:

[
[0] "breaking bad",
[1] "house of cards",
[2] "How i met your mother",
[3] "big bang theory",
[4] "The Newsroom",
[5] "Downton Abbey",
[6] "Mad Men"
]
"breaking bad"
@TheAnonymous
TheAnonymous / find_dates.rb
Created November 7, 2013 12:10
example Method to find a date in a text
def find_dates text
twd = Array.new #twd = text with date
twd.concat text.scan(/[^\d](\d{1,2}[^\w\d ]\d{1,2}[^\w\d ]\d{4})/i) #26.03.1988
twd.concat text.scan(/[^\d](\d{1,2}[^\w\d ]\d{1,2}[^\w\d ]\d{2})/i) #26.03.88
twd.concat text.scan(/[^\d](\d{4}[^\w\d ]\d{1,2}[^\w\d ]\d{1,2})/i) #1988.03.26
twd.concat text.scan(/[^\d](\d{2}[^\w\d ]\d{1,2}[^\w\d ]\d{1,2})/i) #88.03.26
twd.concat text.scan(/(\d{1,2}.?(January|Januar|February|Februar|March|März|April|May|Mai|June|Juni|July|Juli|August|September|October|Oktober|November|December|Dezember)[^\w\d]\d{4})/i)
twd.concat text.scan(/(\d{1,2}.?(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[^\w\d]\d{4})/i)
end
"breaking bad"
"Martin, author of the A Song of Ice and Fire novels, particularly the episode \"Ozymandias\" and commenting that \"Walter White is a bigger monster than anyone in Westeros.\"[134] In his review of the second half of season 5, Seth Amitin of IGN stated, \"This final batch of Breaking Bad is one of the best run of episodes TV has ever offered.\"[135] Awards and nominations[edit] The series has won numerous awards and nominations, including ten Primetime Emmy Awards with one for Outstanding Drama Series"
"house of cards"
"Three of its web series, Arrested Development, Hemlock Grove and House of Cards, earned a combined 14 nominations.[31] Among House of Cards' nine nominations, \"Chapter 1\" received four nominations for the 65th Primetime Emmy Awards and 65th Primetime Creative Arts Emmy Awards becoming the first webisode (online-only episode) of a television series to receive a major Primetime Emmy Award nomination: Outstanding Directing for a Drama Series for David Fincher"

#Singe Command

  • script = record and replay a terminal session
  • tig = git gui
  • yum-builddep programname
  • akmod
  • localmodconfig
  • toast arm paketname
  • /dev/urandom
  • bc = calculator
@TheAnonymous
TheAnonymous / gist:7099525
Created October 22, 2013 12:13
Example of how to escape illegal character in ruby UTF-8
result = result.encode("UTF-8", "binary", :invalid => :replace, :undef => :replace, :replace => "")