This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use fltk::{prelude::*, *}; | |
static COFACTOR: utils::oncelock::Lazy<i32> = utils::oncelock::Lazy::new(|| (app::font_size() as f64 * 2.0) as i32); | |
fn prep_tree(t: &mut tree::Tree) { | |
if let Some(root) = t.next(&t.first().unwrap()) { | |
if root.is_open() { | |
let elems = root.children(); | |
t.resize(t.x(), t.y(), t.w(), (elems + 1) * *COFACTOR); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(concat_idents)] | |
use fltk_sys::{fl::*, frame::*, window::*, group::*, button::{self, *}}; | |
use std::os::raw::*; | |
macro_rules! fstr { | |
($s:literal) => { | |
concat!($s, "\0").as_ptr() as _ | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use fltk::{ | |
app, button, | |
enums::{Color, Font, FrameType}, | |
frame, group, input, | |
prelude::*, | |
window, | |
}; | |
fn style_button(btn: &mut button::Button) { | |
btn.set_color(Color::Cyan); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(unused_variables)] | |
use fltk::{ | |
app::App, | |
button::Button, | |
enums::Event, | |
group::Group, | |
prelude::{GroupExt, WidgetBase, WidgetExt, WindowExt}, | |
window::Window, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use fltk::{prelude::*, *}; | |
fn main() { | |
let mut choice = menu::Choice::default(); | |
choice.add_choice("File/New"); | |
choice.add_choice(&format!("{}\t", "Edit/Cut")); | |
choice.add_choice("File/Open"); | |
choice.add_choice(&format!("Edit/{}", "Copy")); | |
choice.add_choice("Other|Option"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a list of meetings occurring today. | |
function get-meetings() { | |
$olFolderCalendar = 9 | |
$ol = New-Object -ComObject Outlook.Application | |
$ns = $ol.GetNamespace('MAPI') | |
$Start = (Get-Date).ToShortDateString() | |
$End = (Get-Date).ToShortDateString() | |
$Filter = "[MessageClass]='IPM.Appointment' AND [Start] > '$Start' AND [End] < '$End'" | |
$appointments = $ns.GetDefaultFolder($olFolderCalendar).Items | |
$appointments.IncludeRecurrences = $true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Transmission-Shutdown-Script | |
======== | |
#This is the transmission shutdown script I wrote for a [askubuntu question](http://askubuntu.com/questions/202537/transmission-#shutdown-script-for-multiple-torrents) with the help of transmission RPC interface. | |
#**What it Does?** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/sysconfig/transmission-daemon | |
INTERFACE=ppp0 # Set this to the interface you want the daemon to bind to | |
if /sbin/ifconfig $INTERFACE >>/dev/null 2>&1; then | |
BIND_ADDR="`/sbin/ifconfig $INTERFACE | awk '$1 == \"inet\" {print $2}' | awk -F: '{print $2}'`" | |
else | |
BIND_ADDR="127.0.0.1" | |
fi |
NewerOlder