Skip to content

Instantly share code, notes, and snippets.

View JefStat's full-sized avatar

Jeff Statham JefStat

View GitHub Profile
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active March 14, 2024 22:49
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

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 November 28, 2019 17:57
When TestRPC and Geth throw, they behave in a different manner. This Gist is an example on how to cover such a situation.
"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 February 5, 2023 03:26
Get the Promise of an Ethereum transaction receipt when it is finally mined
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;
// 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() {
@nakedible-p
nakedible-p / proxy.js
Created October 19, 2015 19:55
AWS ES proxy
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);
<?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 October 6, 2014 20:48
Nginx server block for Kibana
#
# 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 November 13, 2021 17:46
Extension methods to quickly ignore arguments without repeating It.IsAny<>()
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 December 31, 2015 01:49
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})
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 February 8, 2023 14:56
Use boto to upload directory into s3
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