Skip to content

Instantly share code, notes, and snippets.

@cjus
cjus / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@xeoncross
xeoncross / gitstats.sh
Created November 5, 2012 21:35
Git - calculate how many lines of code were added/changed by someone
# Run this in the project repo from the command-line
# http://stackoverflow.com/a/4593065/99923
git log --shortstat --author "Xeoncross" --since "2 weeks ago" --until "1 week ago" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'
@willprice
willprice / .travis.yml
Last active August 15, 2023 17:12
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@mesgarpour
mesgarpour / appsScript_ListFilesFolders_ver.2.js
Last active April 22, 2024 01:35
[Google Apps Script] List all files & folders in a Google Drive folder, & write into a speadsheet
/*
* Copyright 2017 Mohsen Mesgarpour
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@vidavidorra
vidavidorra / auto-deploy_documentation.md
Last active February 19, 2023 17:37
Auto-deploying Doxygen documentation to gh-pages with Travis CI

Auto-deploying Doxygen documentation to gh-pages with Travis CI

This explains how to setup for GitHub projects which automatically generates Doxygen code documentation and publishes the documentation to the gh-pages branch using Travis CI. This way only the source files need to be pushed to GitHub and the gh-pages branch is automatically updated with the generated Doxygen documentation.

Sign up for Travis CI and add your project

Get an account at Travis CI. Turn on Travis for your repository in question, using the Travis control panel.

Create a clean gh-pages branch

To create a clean gh-pages branch, with no commit history, from the master branch enter the code below in the Git Shell. This will create a gh-pages branch with one file, the README.md in it. It doesn't really matter what file is uploaded in it since it will be overwritten when the automatically generated documentation is published to th

@application2000
application2000 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Last active May 7, 2024 10:38
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@Deadlyelder
Deadlyelder / bitcoin_rpc_class.py
Last active May 16, 2024 12:19
A python script that has as a class Class script
from __future__ import print_function
import time, requests, json
class RPCHost(object):
def __init__(self, url):
self._session = requests.Session()
self._url = url
self._headers = {'content-type': 'application/json'}
def call(self, rpcMethod, *params):
payload = json.dumps({"method": rpcMethod, "params": list(params), "jsonrpc": "2.0"})
@aseure
aseure / manual-merge-and-rebase.sh
Created December 6, 2017 16:01
Manual "Merge and rebase"
git checkout my-new-feat
git rebase master
git checkout master
git merge my-new-feat --ff
@nmarley
nmarley / dash.conf
Last active June 14, 2019 16:07
Docker example using "official" dashpay/dashd image
# network
testnet=0
listen=1
daemon=0 # leave this set to 0 for Docker
logtimestamps=1
maxconnections=256
debug=0
printtoconsole=1
# optional indices (required for Insight)
@jhodges10
jhodges10 / dash_payment_ranks.py
Created June 24, 2019 20:42
Return masternodes nodes ranked for payment
from rpc_methods import get_prgtx_info, get_best_block
from pprint import pprint
from collections import OrderedDict
"""
Sort the set in ascending order by "testHeight" and “ProRegTx hash”.
“testHeight” is determined for each individual entry and equals the “last paid height” (or “registered height” if the masternode was never paid).
If the masternode was PoSe-banned before and revived later, the “revival height” of the masternode is used instead of the “registered height”.
If the “testHeight” of two masternodes is identical, the ProRegTx hash acts as a deterministic tie breaker.
"""