Skip to content

Instantly share code, notes, and snippets.

@arn-e
arn-e / gist:d016ed378a44298a62e6
Created March 17, 2015 01:59
hastalachromium
➜ dotfiles git:(master) ✗ ./process_kill.sh chromium
HADOOKEN, chromium!
[1] 25738 killed ./process_kill.sh chromium
#!/bin/bash
echo "HADOOKEN, $1!"
ps aux | grep $1 | awk '{print $2}' | xargs kill -9
#!/bin/bash
echo "HADOOKEN, $1!"
ps aux | grep $1 | awk '{print $2}' | xargs kill -
@arn-e
arn-e / gist:80a8f49c80d011d71790
Created March 17, 2015 01:40
chromium_processes
➜ ~ ps aux | grep chromium
arne 24533 6.4 0.7 3087240 123124 ? Sl 21:34 0:06 /usr/lib/chromium-browser/chromium-browser --disable-new-tab-first-run --enable-user-scripts
arne 24540 0.6 0.0 466772 11332 ? S 21:34 0:00 /usr/lib/chromium-browser/chromium-browser --disable-new-tab-first-run --enable-user-scripts
arne 24541 0.0 0.0 6504 408 ? S 21:34 0:00 /usr/lib/chromium-browser/chrome-sandbox /usr/lib/chromium-browser/chromium-browser --type=zygote
arne 24542 0.0 0.1 486840 32688 ? S 21:34 0:00 chromium-browser --type=zygote
arne 24548 0.0 0.0 560572 8392 ? S 21:34 0:00 chromium-browser --type=zygote
arne 24580 4.7 0.6 1357008 110692 ? Sl 21:34 0:04 /usr/lib/chromium-browser/chro
arne 24590 0.5 0.2 1295952 37348 ? Sl 21:34 0:00 /usr/lib/chromium-browser/chro
arne 24597 1.2 0.2 137
[HttpGet]
public HttpResponseMessage ReadWidget(long id)
{
WidgetBusiness widgetBusiness = new WidgetBusiness();
Widget widget = widgetBusiness.Get(id);
HttpResponseMessage response = new HttpResponseMessage();
response.Content = new ByteArrayContent(widget.Data);
response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
response.Content.Headers.ContentDisposition.FileName = widget.Id.ToString();
[HttpGet]
public ActionResult ReadWidget(long id)
{
WidgetBusiness widgetBusiness = new WidgetBusiness();
Widget widget = widgetBusiness.Get(id);
return File(widget.Data, "image/jpg");
}
---------------------------objdump---------------------------------------------
00000000 <.text>:
0: b8 ec d2 79 3f mov $0x3f79d2ec,%eax
5: 8d ac 24 28 02 00 00 lea 0x228(%esp),%ebp
c: 68 4e 8c 04 08 push $0x8048c4e
11: c3 ret
-----------------------------GDB-----------------------------------------------
@arn-e
arn-e / int_sqrt.rb
Last active December 21, 2015 11:29
integer square root 'calculation' for ints between 1..255
require 'benchmark'
def sqrt_calc
sqrt_hash = integer_sqrt_hash # instantiating hash table
n = 30000000 # number of test cycles to benchmark
Benchmark.bm do |x|
x.report do
n.times do
rgb_val = rand(1..255);
def test
my_array = [1,2,3,4]
my_array.each do |i|
return i
end
end
puts test
# 1
# Python
def my_func(arg_1 = []):
arg_1.append(1)
print arg_1
my_func()
my_func()
# $ python test.py