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
require 'fiddle' | |
openssl = Fiddle.dlopen('/usr/lib/libssl.so') | |
SSL_library_init = Fiddle::Function.new( | |
openssl['SSL_library_init'], | |
[], | |
Fiddle::TYPE_INT | |
) | |
SSL_library_init.call # no parameters so no () requires |
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
require 'rubygems' | |
require 'ffi' | |
module SSHSocket | |
extend FFI::Library | |
ffi_lib_flags :now, :global | |
ffi_lib 'libssh' | |
attach_function :ssh_init, [], :int | |
attach_function :ssh_bind_new, [], :pointer |
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
genpasswd() { | |
local l=$1 | |
[ "$l" == "" ] && l=20 | |
tr -dc "A-Za-z0-9_%^&*()\`/[]{}|" < /dev/urandom | head -c ${l} | xargs | |
} | |
genpasswd 52 |
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 bash | |
shopt -s nocasematch | |
function exec_code() { | |
file=$1 | |
ext=${file: -4} | |
if [[ $ext == '.jpg' ]]; then | |
echo ', a jpeg file, working on it' | |
mv "$file" "old_$file" |
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
package main | |
import "fmt" | |
type SiteList struct { | |
Title string | |
Address string | |
FeedAddress string | |
Author string | |
} |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
"log" | |
"github.com/streadway/amqp" | |
) |
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
package main | |
import ( | |
"fmt" | |
"math" | |
"os" | |
"unicode/utf8" | |
) | |
func calculateSmsFragments(message string) uint64 { |
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
package main | |
import ( | |
"fmt" | |
"regexp" | |
"strings" | |
) | |
var utf8GsmChars = map[string]string{ | |
`@`: "\x00", `£`: "\x01", `$`: "\x02", |
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
CREATE TABLE posts ( | |
id BIGINT NOT NULL PRIMARY KEY, | |
name VARCHAR(255), | |
title VARCHAR(255), | |
content VARCHAR(255), | |
timestamps timestamp | |
); | |
CREATE GENERATOR POSTS_SEQ; |
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 ruby | |
# gem install ruby-filemagic | |
# please note that this program works only on Unix based systems and Linux. | |
# It uses the "file command" library (and information) in a native code to validate file content (rather then extension). | |
# Important note: It only read the *header* of the files rather the whole, content so we might still have malicious content ... :( | |
require 'rubygems' | |
require 'filemagic' |