Skip to content

Instantly share code, notes, and snippets.

View dany-eudes's full-sized avatar

Dany Eudes dany-eudes

  • celerasoft.com
  • Sao Paulo, Brazil
View GitHub Profile
@dany-eudes
dany-eudes / exportSpreadsheet.gs
Created April 8, 2025 13:39 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@dany-eudes
dany-eudes / default_mikrotik_wired_router.rsc
Created June 13, 2024 14:52 — forked from bile0026/default_mikrotik_wired_router.rsc
default config for wired mikrotik router
#| Welcome to RouterOS!
#| 1) Set a strong router password in the System > Users menu
#| 2) Upgrade the software in the System > Packages menu
#| 3) Enable firewall on untrusted networks
#| 4) Set your country name to observe wireless regulations
#|
#|--------------------------------------------------------------------------------
#| RouterMode:
#| * WAN port is protected by firewall and enabled DHCP client
#| * Wireless and Ethernet interfaces (except WAN port/s)
@dany-eudes
dany-eudes / nginx.conf
Created April 2, 2024 18:25 — forked from v0lkan/nginx.conf
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@dany-eudes
dany-eudes / addStaticArp
Created December 15, 2021 18:20 — forked from Pablo1/addStaticArp
Mikrotik RouterOS Script - Add Static DHCP Leases to ARP List This script will update the ARP List with all static, enabled leases. It makes the changes in place (i.e. it doesn't delete all the ARP entries first) to minimize disruptions. Limitation of the script is that the interface for the ARP entry needs to be hardcoded for now.
:local wanInterfaceName "ether1_wan";
# Remove ARP entries that do not have static DHCP leases or are disabled
:foreach arpId in=[/ip arp find] do={
#Don't remove the dynamic entry on the WAN side
:if ([/ip arp get $arpId interface] != $wanInterfaceName) do={
  1. Download and install p4Merge (Helix P4Merge: Visual Merge Tool) from Perforce page
  2. Configure Git Extensions (Tools / Settings / Git Config) with the follow values (see image):
    • Mergetool: p4merge
    • Path to mergetool: C:/Program Files/Perforce/p4merge.exe
    • Mergetool command: "C:/Program Files/Perforce/p4merge.exe" "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    • Difftool: p4merge
    • Path to difftool: C:/Program Files/Perforce/p4merge.exe
  • Difftool command: "C:/Program Files/Perforce/p4merge.exe" "$LOCAL" "$REMOTE"
Adding a Tray Icon functionality to SWT application is quite easy. But to do something similar in Eclipse RCP is a little involved. This Blog entry explains how I do it in JBlogEditor.
1. We want our RCP application to behave thusly: Minimize to taskbar when minimize button is clicked.
2. Minimize to tray when close button is clicked.
3. Restore workbench window when tray icon is double clicked.
4. Show Exit and Open menu when the tray icon is right clicked.
For the 1st behaviour, we do not need to alter the normal window behaviour.
For the 2nd behaviour, we need to prevent the Workbench from perform its default behaviour of closing. To do that we override public boolean preWindowShellClose() method of WorkbenchWindowAdvisor. Quite possibly you already have your own XXXWorkbenchWindowAdvisor. Just override public boolean preWindowShellClose() method in there. To prevent the workbench from closing, we return false from this method.
Have you ever tried to use animated GIF in Eclipse RCP? Unlike using regular image you have to provide your own mechanism that switches between image frames when using animated GIF (more about this is here). Fortunately, you can save in implementing your own thread by using org.eclipse.ui.internal.ImageCycleFeedbackBase and org.eclipse.ui.internal.AnimationEngine (though these classes are still in internal package). Let's say we need to add an animated image to a CLabel. First of all, we extend ImageCycleFeedbackBase:
public class AnimatedLabelFeedback extends ImageCycleFeedbackBase {
private CLabel label;
public AnimatedLabelFeedback(Shell parentShell, CLabel item, Image[] images) {
super(parentShell, images);
label = item;
}
// I first built a class that would server as a model for the options that I wanted to perform on it.
import org.eclipse.swt.widgets.*;
class ControlMetaItem {
Control item = null;
int maxTextLength = -1;
boolean includeInTabOrder = false;
boolean selectAllOnFocus = false;