This file contains hidden or 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
(define (myabs x) | |
(cond ((< x 0) (* x -1)) | |
((x >= 0) (* x 1)))) | |
(define (myexpt x y) | |
(cond ((< x 0) (* (cond ((odd? (myabs y)) -1) | |
(else 1)) | |
(myexpt (myabs x) y))) | |
((< y 0) (/ 1 (myexpt x (myabs y)))) | |
((= y 0) 1) |
This file contains hidden or 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
/* | |
* single command version: | |
* jrunscript -e 'java.lang.System.getProperties().list(java.lang.System.out);' | |
*/ | |
import java.util.Properties; | |
public class jsysprop { | |
public static void main(String[] args) { | |
System.getProperties().list(System.out); |
This file contains hidden or 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
// exit code 0 if JCE is available, 1 otherwise | |
/* | |
* one-liner: | |
* jrunscript -e 'exit (javax.crypto.Cipher.getMaxAllowedKeyLength("AES") < 256);' | |
*/ | |
import javax.crypto.Cipher; | |
public class jcecheck { |
This file contains hidden or 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 re | |
def get_cpu_count(): | |
cpu_count = 0 | |
cpu_file = '/proc/cpuinfo' | |
ch = open(cpu_file, 'r') | |
for line in ch: | |
if re.match('processor', line): | |
cpu_count = cpu_count + 1 | |
ch.close() |
This file contains hidden or 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
Host * | |
AddKeysToAgent yes | |
ForwardAgent yes | |
HostKeyAlgorithms +ssh-rsa | |
KexAlgorithms +diffie-hellman-group1-sha1 | |
LogLevel QUIET | |
PubkeyAcceptedKeyTypes +ssh-rsa | |
ServerAliveCountMax 10 | |
ServerAliveInterval 30 | |
StrictHostKeyChecking no |
This file contains hidden or 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
/* | |
* via http://stackoverflow.com/questions/15720822/how-to-get-names-of-classes-inside-a-jar-file | |
*/ | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.util.Iterator; | |
import java.util.List; |
This file contains hidden or 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
function myexpt(x, y) { | |
var expt = 1; | |
if (x < 0) { | |
// XXX - need to check Number.isFinite(parseFloat(y)) and cast for modulus via parseInt | |
if (y % 2 != 0) { | |
expt = -1 * myexpt(Math.abs(x), y); | |
} else { | |
expt = myexpt(Math.abs(x), y); | |
} | |
} else { |
This file contains hidden or 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/bash | |
mkdir -p out | |
for i in $(cat advertisers_to_block.txt) ; do | |
{ | |
echo '{ "'${i}'" : [' | |
twurl -d "screen_name=${i}" /1.1/blocks/create.json | jq -M . | |
echo ' ] }' | |
} | tee out/${i}.json >/dev/null 2>&1 |
This file contains hidden or 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
#1 0 * * * wget -q -O - 'http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0' | sed '/<pre>/,/<\/pre>/!d' | grep -v 'pre>' > /etc/hosts.adservers | |
1 0 * * * wget -q -O - 'http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext' > /etc/hosts.adservers |
This file contains hidden or 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 python | |
import fileinput | |
import json | |
from dicttoxml import dicttoxml | |
jsonin = "" | |
jsondict = "" | |
jsonxml = "" |
OlderNewer