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
class ExampleCamelFtpStream { | |
static void main(String[] args) { | |
new ExampleCamelFtpStream().run() | |
} | |
void run() { | |
try { |
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
#!/bin/sh | |
cat << __EOF__ | sudo /usr/bin/env python3 | |
from smtpd import SMTPServer | |
import asyncore | |
import datetime | |
PORT=25 | |
HOST='localhost' |
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
#!/bin/sh | |
cat << __EOF__ | sudo /usr/bin/env python3 | |
PORT=25 | |
HOST='localhost' | |
import smtpd, asyncore | |
server = smtpd.DebuggingServer((HOST, PORT), None) | |
print(f"[SMTP {HOST}:{PORT}]") |
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
def bytes2String(byte[] bytes) { | |
long count = 0 | |
long max = 16 | |
def dump = '\n POS | DATA | ASCII | EBCDIC' | |
def curHex = '' | |
def curChars = '' | |
def curCvtChars = '' |
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
#!/bin/sh | |
# | |
# Grep all git repos under the current directory. | |
# | |
# Usage: git-grep-all <exp> | |
# | |
# Examples: | |
# | |
# git-grep-all Foo | |
# |
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
import random | |
import string | |
import sys | |
import time | |
import os | |
args = sys.argv[1:] | |
SLEEP_TIME = 0.01 | |
LIMIT = 10 |
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
def merge(a, b): | |
c = {} | |
for k in a: | |
c[k] = a[k] | |
for k in b: | |
if k in c: | |
v1 = c[k] | |
v2 = b[k] | |
if isinstance(v1, dict) and isinstance(v2, dict): |
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
import groovyx.net.http.HTTPBuilder | |
import org.apache.http.client.HttpClient | |
import org.apache.http.impl.client.DefaultHttpClient | |
import org.apache.http.impl.conn.PoolingClientConnectionManager | |
import org.apache.http.impl.conn.SchemeRegistryFactory | |
import org.apache.http.params.HttpParams | |
import javax.net.ssl.SSLContext | |
import javax.net.ssl.SSLSocket | |
import java.security.SecureRandom |
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 org.example.utils; | |
import lombok.extern.slf4j.Slf4j; | |
import java.util.function.Supplier; | |
/** | |
* Log elapsed time for a function. | |
* | |
* Usage: |
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
import java.security.SecureRandom; | |
import java.util.Random; | |
public class RandomCodeGenerator { | |
static final SecureRandom RANDOM = new SecureRandom(); | |
static final char[] LETTERS = "ABCEFGHJKMNPQRSTWXYZ".toCharArray(); | |
static final char[] NUMBERS = "0123456789".toCharArray(); | |
static final int DEFAULT_NUM_CODES = 20; |
OlderNewer