Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am anantn on github.
  • I am anant (https://keybase.io/anant) on keybase.
  • I have the public key with fingerprint 42DD 4F90 7C5F 4576 D6F4  2202 C31C 2D8C 7B4B 6B02

To claim this, I am signing this object:

@okochang
okochang / ses_file_send.rb
Created February 24, 2012 08:10
awssdk for ruby send email with attaching file
# -*- coding: utf-8 -*-
require 'aws-sdk'
# ACCESS_KEYとSECRET_KEYを定義します
ACCESS_KEY = 'YOUR_ACCESS_KEY'
SECRET_KEY = 'YOUR_SECRET_KEY'
# 送信メールの本文を作成します
body = 'Sample email attaching file.'
# ファイルを読み込みbase64フォーマットにエンコードします
@backflip
backflip / config.rb
Last active July 11, 2017 14:53
Using Redcarpet and Middleman Syntax for Markdown and HAML files
class CustomMarkdown < Middleman::Extension
$markdown_options = {
autolink: true,
fenced_code_blocks: true,
no_intra_emphasis: true,
strikethrough: true,
tables: true,
hard_wrap: true,
with_toc_data: true
}
@bsodmike
bsodmike / howto.md
Last active August 30, 2017 04:15
HOWTO: Setup mail forwarding with Sendmail in Ubuntu 10.04 LTS

Copyright (c) 2011, Michael de Silva (michael@mwdesilva.com) Blog: http://www.bsodmike.com ~ Twitter: @bsodmike

Fix: 'config error: mail loops back to me (MX problem?)'

To prevent receiving config error: mail loops back to me (MX problem?) errors, you need to add each virtualdomain.tld to the /etc/mail/local-host-names file and re-compile your sendmail config via make.

You have asked mail to a domain (e.g., domain.net) to be forwarded to a specific host (in this case, relay.domain.net) by using an MX record, but the relay machine doesn't recognise itself as domain.net. Add domain.net to /etc/mail/local-host-names [known as /etc/sendmail.cw prior to version 8.10] (if you are using FEATURE(`use_cw_file')) or add "Cw domain.net" to your configuration file.

Source: http://www.sendmail.com/sm/open_source/support/support_faq/general_issues_faq/#4.5

@BakermanLP
BakermanLP / iwscan_csv.pl
Created March 18, 2016 13:27
iwlist scanning to csv
#!/usr/bin/perl
use POSIX;
$_ = `iwlist wlan0 scanning`;
$n = 0;
for $match (split(/(?=Cell)/)) {
# print "\nCell #######################################\n";
my @lines = split /\n/,$match;
$essid="";
network={
ssid="eduroam"
priority=10
#scan_ssid=1
proto=WPA
key_mgmt=WPA-EAP
pairwise=TKIP
eap=TTLS
ca_cert="/etc/ssl/certs/Equifax_Secure_Global_eBusiness_CA.pem"
anonymous_identity="anonymous@m8.stud.ku.dk"
@carolineartz
carolineartz / _ex.md
Last active February 27, 2018 15:50
example testing out `ActiveRecord::Aggregations`

Usage

# in your controller you can use
@domain = CreateDomains.new('car.oline.codes').call #=> returns Domain with name 'car' that is the child of `oline.codes`
@domain.web_address.to_s #=> 'car.oline.codes'

You can use your logic for subtree equality to compare the actual web_address value objects, which are immutable. You could also see all the 'parent' strings for a given web_address object

@EricADockery
EricADockery / Fastfile
Created July 25, 2017 16:42
Parallel iOS Testing using Bluepill
lane :bluepill do
scan(scheme: “myApp”, build_for_testing: true)
sh “bash ./bluepill.sh“
end
@p0deje
p0deje / jenkins_restart_dead_executors.groovy
Last active August 10, 2018 07:30
Restart all dead executros on Jenkins (use from Script Console)
def deadExecutors = Jenkins.instance.computers.collect { c ->
c.executors.findAll { !it.isActive() }
}.flatten()
deadExecutors.each { it.doYank() }
@theapi
theapi / knock.py
Last active November 27, 2018 01:11
Simple demo to detect knocking from a piezo sensor on the Raspberry Pi.
#!/usr/bin/python
import time, signal, sys
from Adafruit_ADS1x15 import ADS1x15
def signal_handler(signal, frame):
print 'You pressed Ctrl+C!'
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
#print 'Press Ctrl+C to exit'