Skip to content

Instantly share code, notes, and snippets.

@ArmandoAssuncao
ArmandoAssuncao / ruby_selenium_with_proxy.rb
Last active November 26, 2023 14:29
Ruby Selenium with Proxy
# Obs: Work only in Firefox 66.x or prior, because the function "driver.switch_to.alert.send_keys" not work in new versions.
# tested in selenium-webdriver (3.142.7), webdrivers (4.6.0) and firefox (66.0.5)
# Download firefox to folder
# config/initializers/selenium.rb
Selenium::WebDriver::Firefox::Binary.path = 'path/to/firefox/66.x'
# -----------------------------------------------------------------------------------------------------
# Code
@berkant
berkant / cloud-init.cfg
Last active April 26, 2024 17:58
Cloud-init config to set up my Ubuntu dev machine.
## template: jinja
#cloud-config
{% if v1.distro_release == 'focal' %}
users:
- name: berkant
shell: /usr/bin/bash
ssh_import_id: gh:berkant
sudo: ALL=(ALL:ALL) NOPASSWD:ALL
@parrotmac
parrotmac / dbus-send-modem-command.sh
Created November 15, 2018 08:14
Send serial command to modem using ModemManager via DBus
#!/bin/sh
# Sends command 'ATI' to modem #3
# Get a list of modems by running `mmcli -L`
# Timeout is (probably) 2 seconds
# Also see https://www.freedesktop.org/software/ModemManager/api/latest/gdbus-org.freedesktop.ModemManager1.Modem.html#gdbus-method-org-freedesktop-ModemManager1-Modem.Command
dbus-send --system --dest=org.freedesktop.ModemManager1 --print-reply /org/freedesktop/ModemManager1/Modem/3 org.freedesktop.ModemManager1.Modem.Command string:'ATI' uint32:2000
@dideler
dideler / bot.rb
Last active July 15, 2024 06:56
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@peterforgacs
peterforgacs / Windows10AWSEC2.md
Last active May 29, 2024 06:50
Running Windows 10 on AWS EC2

Running Windows 10 on AWS EC2

Downloading the image

Download the windows image you want.

AWS vmimport supported versions: Microsoft Windows 10 (Professional, Enterprise, Education) (US English) (64-bit only)

So Home wont work.

// junkterm is a quick and dirty serial terminal.
package main
import (
"io"
"log"
"os"
"github.com/pkg/term"
"github.com/spf13/cobra"
package main
import (
"code.google.com/p/go.net/websocket"
)
type connection struct {
// The websocket connection.
ws *websocket.Conn
@icholy
icholy / gobreak.sh
Last active December 16, 2015 19:18
Shell script to simplify setting GDB breakpoints
# Demo http://ascii.io/a/3019
# build
gdbb () {
# build with debug flags
go build -gcflags "-N -l" -o out
# make sure the build didn't fail
if [ $? != 0 ]; then return; fi
@physacco
physacco / test_periodic_timer.go
Created March 10, 2013 06:52
This demonstrates usage of timer in go. Both one-shot timer and periodic timer. In the periodic timer example, goroutine and select are used.
package main
import (
"fmt"
"time"
)
// The timeout handler.
func ontimeout(t time.Time) {
fmt.Println("[timeout] ", t)
@wofeiwo
wofeiwo / gist:3634357
Created September 5, 2012 10:00
Golang daemonize
/* ivan(a.t)mysqlab.net */
package main
import (
"syscall"
"os"
"log"
)
func daemon(nochdir, noclose int) int {