Skip to content

Instantly share code, notes, and snippets.

Avatar

Jef Statham JefStat

View GitHub Profile
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active Jun 30, 2022
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64
View clean-up-boot-partition-ubuntu.md

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@xavierlepretre
xavierlepretre / expected_exception_testRPC_and_geth.js
Last active Nov 28, 2019
When TestRPC and Geth throw, they behave in a different manner. This Gist is an example on how to cover such a situation.
View expected_exception_testRPC_and_geth.js
"use strict";
/**
* @param {!Function.<!Promise>} action.
* @param {!Number | !string | !BigNumber} gasToUse.
* @returns {!Promise} which throws unless it hit a valid error.
*/
module.exports = function expectedExceptionPromise(action, gasToUse) {
return new Promise(function (resolve, reject) {
try {
@xavierlepretre
xavierlepretre / getTransactionReceiptMined.js
Last active Jun 10, 2022
Get the Promise of an Ethereum transaction receipt when it is finally mined
View getTransactionReceiptMined.js
const Promise = require("bluebird");
const sequentialPromise = require("./sequentialPromise.js");
/**
* @param {!string | !Array.<!string>} txHash, a transaction hash or an array of transaction hashes.
* @param {Number} interval, in seconds.
* @returns {!Promise.<!object> | !Promise.<!Array.<!object>>} the receipt or an array of receipts.
*/
module.exports = function getTransactionReceiptMined(txHash, interval) {
const self = this;
View how_much_netflix.js
// how_much_netflix.js
// A script that looks through your Netflix viewing activity and
// tallys up how much time you've spent watching Netflix
//
// INSTRUCTIONS TO USE:
// Open https://www.netflix.com/WiViewingActivity and the developer console
// Copy and paste this script into the developer console and press enter
//
(function() {
var fetchAllViewedItems = function() {
View proxy.js
var AWS = require('aws-sdk');
var http = require('http');
var httpProxy = require('http-proxy');
var express = require('express');
var bodyParser = require('body-parser');
var stream = require('stream');
if (process.argv.length != 3) {
console.error('usage: aws-es-proxy <my-cluster-endpoint>');
process.exit(1);
View TypeMemberLayout.xaml
<?xml version="1.0" encoding="utf-16"?>
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="COM interfaces" Priority="2000">
<TypePattern.Match>
<And>
<Kind Is="Interface" />
<Or>
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
</Or>
@thisismitch
thisismitch / nginx.conf
Created Oct 6, 2014
Nginx server block for Kibana
View nginx.conf
#
# Nginx proxy for Elasticsearch + Kibana
#
# In this setup, we are password protecting the saving of dashboards. You may
# wish to extend the password protection to all paths.
#
# Even though these paths are being called as the result of an ajax request, the
# browser will prompt for a username/password on the first request
#
# If you use this, you'll want to point config.js at http://FQDN:80/ instead of
@ngocvantran
ngocvantran / MoqExtensions.cs
Last active Nov 13, 2021
Extension methods to quickly ignore arguments without repeating It.IsAny<>()
View MoqExtensions.cs
using System;
using System.Linq.Expressions;
using Moq.Language.Flow;
namespace Moq
{
public static class MoqExtensions
{
public static ISetup<T, TResult> SetupIgnoreArgs<T, TResult>(this Mock<T> mock,
Expression<Func<T, TResult>> expression)
@DTTerastar
DTTerastar / gist:7917094
Last active Dec 31, 2015
Log a function call easily w/ log4net. Shouldn't have performance impact if not set to log. Uses [CallerMemberName] so you don't have to supply it. Usage: logger.InfoCall(()=>new { param1, param2, param3})
View gist:7917094
public static class LogExtensions
{
public static void InfoCall(this ILog log, Func<object> args = null, [CallerMemberName] string name = "")
{
if (log.IsInfoEnabled)
log.Info(new Message(name, (args != null) ? args() : null));
}
public static void DebugCall(this ILog log, Func<object> args = null, [CallerMemberName] string name = "")
{
@SavvyGuard
SavvyGuard / botos3upload.py
Last active Aug 25, 2021
Use boto to upload directory into s3
View botos3upload.py
import boto
import boto.s3
import os.path
import sys
# Fill these in - you get them when you sign up for S3
AWS_ACCESS_KEY_ID = ''
AWS_ACCESS_KEY_SECRET = ''
# Fill in info on data to upload