Skip to content

Instantly share code, notes, and snippets.

View DanyWallace's full-sized avatar
💭
everyone is a girl on the internet

Daniel Wallace DanyWallace

💭
everyone is a girl on the internet
View GitHub Profile
@DanyWallace
DanyWallace / bingsearch.rb
Created February 12, 2024 14:47
Automate your bing searches for points using selenium and google trends to get search queries
require "selenium-webdriver"
require "redis"
require "net/http"
# open up chromium, login to your bing account, then update the datadir bellow
data_dir_arg_1 = '--user-data-dir=C:\data\chromium.p\dany.lts'
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument(data_dir_arg_1)
driver = Selenium::WebDriver.for :chrome, options: options
@DanyWallace
DanyWallace / ssh-agent.rb
Created October 27, 2023 22:17
add the current ssh-agent to your session
# run on your wsl shell:
# eval `ruby file.rb`
def get_agent
ps_aux_output = `ps aux | grep ssh-agent`
agent_pid = ps_aux_output.split("\n")[0]
agent_pid = agent_pid.match(/\d+/)[0].to_i - 1
ssh_auth_sock = `find /tmp/ssh-*/ -type s -name agent.#{agent_pid}`
print "export SSH_AUTH_SOCK=#{ssh_auth_sock}"
end
@DanyWallace
DanyWallace / webdriver.rb
Last active October 11, 2023 06:59
a cheatsheet or example usage of selenium with ruby in windows (works for linux)
require "selenium-webdriver"
# See the following for newer drivers : https://googlechromelabs.github.io/chrome-for-testing/#stable
# ^ https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/*/win64/chrome-win64.zip
# ^ note the '*', and navigate to C:\Users\USERNAME\.cache\selenium\chrome\win64, replace files there
# otherwise for older: https://chromedriver.chromium.org/downloads
# remember:
# https://github.com/SeleniumHQ/selenium/wiki/Ruby-Bindings
@DanyWallace
DanyWallace / Embedding GoLang into a Ruby application.md
Created July 11, 2022 07:01 — forked from schweigert/Embedding GoLang into a Ruby application.md
Embedding GoLang into a Ruby application - Blogpost to Magrathealabs

Go Title

I am passionate about Ruby, but its execution time compared to other languages is extremely high, especially when we want to use more complex algorithms. In general, data structures in interpreted languages become incredibly slow compared to compiled languages. Some algorithms such as ´n-body´ and ´fannkuch-redux´ can be up to 30 times slower in Ruby than Go. This is one of the reasons I was interested in embedding Go code in a Ruby environment.

For those who do not know how shared libraries operate, they work in a similar way as DLLs in Windows. However, they have a native code with a direct interface to the C compiler.

Note Windows uses the DLL system, and in this case, this does not necessarily have to be in native code.

One example is DLLs written in C#, which runs on a virtual machine. Because I do not use windows, I ended up not testing if it is poss

@DanyWallace
DanyWallace / latency.markdown
Created July 9, 2022 20:14 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@DanyWallace
DanyWallace / euphrasia2
Created August 25, 2020 22:58 — forked from bohoomil/euphrasia2
euphrasia X color scheme -- updated
!! euphrasia v2 by bohoomil
! euphrasia fg/bg
URxvt*background: #090C19
URxvt*foreground: #E6E6E6
URxvt*cursorColor: #1AAA13
! X.org apps bg/fg
*background: #D0CECB
*foreground: #090C19
@DanyWallace
DanyWallace / soundcloud.rb
Created March 2, 2016 20:14 — forked from arashm/soundcloud.rb
Simple script to downoad MP3 files from SoundCloud via WGet
#!/usr/bin/env ruby
require 'uri'
require 'httparty'
# Download mp3 files from SoundCloud
# Usage:
# ./soundcloud.rb https://soundcloud.com/tara-tiba/paeez_tara-tiba
class SoundCloud
include HTTParty
base_uri 'https://soundcloud.com'