This file contains 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
-- This script allows to programmatically send a SMS from a Mac using an iPhone carrier plan | |
-- Requirements : | |
-- * iPhone running iOS 8.1+ with a proper carrier plan | |
-- * Mac running macOS 10.10+ | |
-- * Message forwarding should be properly configured on both devices. See | |
-- https://support.apple.com/en-gb/HT208386 | |
-- Usage : | |
-- This script should be invoqued via Terminal with the osascript command : |
This file contains 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
# Easily code your writeln() Pike function | |
int writeln(string fmt, mixed ... args) | |
{ | |
fmt += "\n"; | |
write(fmt, @args); | |
return 0; | |
} |
This file contains 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
// Breaking the 838:59:59 limit of MySQL's SEC_TO_TIME() and TIME_TO_SEC() | |
//! @param seconds | |
//! The number of seconds to convert to time | |
//! @return | |
//! Seconds converted to time (123:45:67) as a string, -1 if failed | |
int|string sec_to_time(int _seconds) | |
{ | |
int seconds = (int)_seconds; | |
This file contains 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
string random_printable_string(int size) | |
{ | |
string rand = ""; | |
for(int i=0; i<size; i++) | |
rand += String.int2char(random(94)+32); | |
return rand; | |
} |
This file contains 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
#!/usr/bin/pike | |
// Pre-shared key. Should be 16 bytes, kept secret | |
string key = "secret16byteskey"; | |
// Message to encode | |
string msg_from = "What's your name, James?"; | |
// Initialisation vector. Should be 16 bytes, randomly generated for each iteration | |
string iv = random_string(16); | |
int main(int argc, array(string) argv) |
This file contains 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
#!/usr/bin/pike | |
// Pre-shared key. Should be 16 bytes, kept secret | |
string key = "secret16byteskey"; | |
// Message to encode | |
string msg_from = "What's your name, James?"; | |
int main(int argc, array(string) argv) | |
{ | |
write("key : %O\nmsg : %O\n", key, msg_from); |
This file contains 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
> object t = System.Time(); t->sec; t->usec; t->usec_full; | |
(1) Result: 1556201631 | |
(2) Result: 393431 | |
(3) Result: 1556201631393970 | |
> object s = Calendar.parse("%Y-%M-%aT%h:%m:%s.%f","2019-04-25T15:10:03.193000+00:00"); | |
> s->f_unix_time(); | |
(1) Result: 1556197803.193 |
This file contains 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
; You may miss MeetMe() from your old asterisk box | |
; Here's an asterisk fragment whose goal is to mimic the following MeetMe() line using Confbridge() | |
; exten => 42,1,MeetMe(,cIxDsM) | |
; call 42 to create/join dynamic pin-protected ConfBridge() conference | |
; adapt context and call number to your actual numbering plan | |
[your-random-context] | |
exten => 42,1,NoOp() | |
same => n,Goto(conference,s,1) | |
same => n,Hangup() |
This file contains 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
(Calendar.dwim_day("2001-02-12")->distance(Calendar.now())->how_many(Calendar.Day)); |
This file contains 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
#!/usr/bin/env pike | |
// This script take a dirty CSV as input | |
// Output a white-trimed CSV : spaces, tabs, CR, LF | |
// Set up the following | |
string in_dirty_path = ""; | |
string out_clean_path = ""; | |
int i_ve_set_file_paths = 0; |
NewerOlder