Skip to content

Instantly share code, notes, and snippets.

@lesiki
lesiki / mx_lookup.py
Created March 30, 2022 16:59
Script to identify the mail host for a set of domains
import dns.resolver
input_domains = [
"1.com",
"2.com",
"3.com",
"etc.com",
]
for domain in input_domains:
@lesiki
lesiki / sokoban-solver.groovy
Created August 16, 2018 15:23
Sokoban Solver
def originalNumbers = [6,3,5,4,2]
def ops = ['x', '-', '-', '+']
def target = 21
def combine(a, b, op) {
if(op == '+') {
return a + b
}
else if (op == '-') {
return a - b
{
"apiKey": "your-API-Key",
"payload": {
"message":"Hi people!",
"recipients":[
{ "type":"mobile", "value":"+1234567890" }
]
}
}
@lesiki
lesiki / AddsToAHundred.groovy
Created May 9, 2015 14:56
Coding challenge
class AddsToAHundred {
/*
Challenge: Write a program that outputs all possibilities
to put + or - or nothing between the numbers 1, 2, ..., 9 (in this order)
such that the result is always 100. For example: 1 + 2 + 34 – 5 + 67 – 8 + 9 = 100.
from https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
*/
public static void main(String [] args) {
@lesiki
lesiki / fsmswebconnection.php
Last active January 1, 2024 02:58
PHP sample code for sending SMS through the FrontlineCloud API
<?php //FILE: sms_api.php
function sendSMS($number, $message) {
$url = "example"; // Set your frontlinesms or frontlinecloud webconnection url here
$secret = "secret"; // Set the secret here
$request = array(
'secret' => $secret,
'message' => $message,
'recipients' => array(array(
@lesiki
lesiki / AppResources.groovy
Created January 30, 2013 10:34
Grails Resources setup that automatically adds all resources in a folder
import org.codehaus.groovy.grails.web.context.ServletContextHolder as SCH
modules = {
core {
resource url: '/resources/css/app.css', disposition: 'head'
resource url: '/resources/css/myapp.css', disposition: 'head'
resource url: '/extjs/ext-all-debug.js', dispostion: 'head'
getFilesForPath('/app').each {
resource url: it