Skip to content

Instantly share code, notes, and snippets.

@svzdvd
svzdvd / Reset OSX Time Machine Permissions
Created April 2, 2018 13:13
Reset OSX Time Machine Permissions
# Remove no-change attributes
sudo chflags nouchg ~/dir-to-fix
# Recursively clear all entended attributes
sudo xattr -rc ~/dir-to-fix
# Recursively reset to rational owner
sudo chown -R username:staff ~/dir-to-fix
# Recursively remove an ACL
// names / ids: https://docs.google.com/spreadsheets/d/1wTTuxXt8n9q7C4NDXqQpI3wpKu1_5bGVmP9Xz0XGSyU/edit#gid=0
function ccprice(name, currencyOpt) {
var currency = currencyOpt || "usd";
var url = 'https://api.coingecko.com/api/v3/simple/price?ids=' + name + '&vs_currencies=' + currency.toLowerCase();
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
var jsonobject = JSON.parse(json);
from web3 import Web3
import json
wallet_address = 'YOUR_WALLET_ADDRESS'
w3 = Web3(Web3.HTTPProvider('https://bsc.getblock.io/mainnet/?api_key=GET_BLOCK_API_KEY'))
wei_balance = w3.eth.getBalance(wallet_address)
eth_balance = w3.fromWei(wei_balance, 'ether')
print(eth_balance)
run_mapreduce() {
hadoop jar /usr/lib/hadoop-0.20-mapreduce/contrib/streaming/hadoop-streaming-2.0.0-mr1-cdh4.1.1.jar -mapper $1 -reducer $2 -file $1 -file $2 -input $3 -output $4
}
alias hs=run_mapreduce
run_mapcombinereduce() {
hadoop jar /usr/lib/hadoop-0.20-mapreduce/contrib/streaming/hadoop-streaming-2.0.0-mr1-cdh4.1.1.jar -mapper $1 -reducer $2 -combiner $2 -file $1 -file $2 -input $
}
import java.lang.management.LockInfo;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;
import java.util.HashMap;
import java.util.Map;
/**
* http://stackoverflow.com/a/2362939
*/
@svzdvd
svzdvd / ubuntu-jdk-installation.sh
Last active December 17, 2015 21:49
Oracle JDK 7 installation on Ubuntu
wget --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-linux-x64.tar.gz"
tar xzf jdk-7u51-linux-x64.tar.gz
sudo mv jdk1.7.0_51 /usr/lib/jvm/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_51/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_51/bin/javac" 1
# interactive selection
sudo update-alternatives --config java
# interactive selection
@svzdvd
svzdvd / jdk-download.sh
Created May 30, 2013 12:47
Download Oracle JDK using wget
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F" "http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-x64.tar.gz"
@svzdvd
svzdvd / 02_setup_solr.sh
Last active December 14, 2015 11:49
Setup Solr 1.4.1 on Centos 6.3
cd /usr/src
curl http://archive.apache.org/dist/lucene/solr/1.4.1/apache-solr-1.4.1.tgz | tar xfz -
mkdir -p /data/solr
cp -Rv apache-solr-1.4.1/example/solr/* /data/solr
cp apache-solr-1.4.1/dist/apache-solr-1.4.1.war /data/solr/solr.war
chown -Rc tomcat /data/solr/
cd /etc/tomcat6/Catalina/localhost/
wget https://gist.github.com/svzdvd/5081810/raw/20785988538479906a584037a2839aba6e3382ba/solr.xml
@svzdvd
svzdvd / 01_centosckan_packages.sh
Created March 4, 2013 11:15
CKAN 1.8 setup on Centos 6.3
yum install -y sudo
yum groupinstall -y "Development Tools"
yum install -y kernel-devel
yum install -y java-1.6.0-openjdk
yum install -y java-1.6.0-openjdk-devel
yum install -y tomcat6
yum install -y xalan-j2
yum install -y postgresql postgresql-server postgresql-devel
yum install -y mercurial git subversion
@svzdvd
svzdvd / solr.xml
Last active December 14, 2015 11:48
<?xml version="1.0" encoding="utf-8"?>
<Context docBase="/data/solr/solr.war" debug="0" privileged="true" allowLinking="true" crossContext="true">
<Environment name="solr/home" type="java.lang.String" value="/data/solr" override="true" />
</Context>