Skip to content

Instantly share code, notes, and snippets.

@up1
up1 / 1.txt
Last active December 17, 2017 03:18
Docker with JVM
$docker run -m 200MB openjdk:8u131-jre-alpine java -XshowSettings:vm -version
VM settings:
Max. Heap Size (Estimated): 444.50M
Ergonomics Machine Class: server
Using VM: OpenJDK 64-Bit Server VM
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (IcedTea 3.4.0) (Alpine 8.131.11-r1)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@jason-riddle
jason-riddle / burn_sdcard.sh
Last active October 21, 2019 01:37
Burn to sdcard using dd and pv #guide #complete
SD_CARD="/dev/disk1000"
LOCAL="~/Desktop/2013-09-25-wheezy-raspbian-minimal.img"
# First, unmount the disk
diskutil unmountDisk ${SD_CARD}
# If you are writing from SD card to Mac, calculate the number of bytes to skip as well as the size to pipe to pv.
# 5785600 bytes (count) * 512 (default bs) = 2962227200 bytes == 2825 Megabytes
dd if=${SD_CARD} count=5785600 | pv -s 2825M | dd of=${LOCAL} count=5785600
@peterwwillis
peterwwillis / cliv
Last active May 2, 2021 19:01
cliv: Command-LIne wrapper to execute different Versions of binaries in different directories using different environment variables
#!/usr/bin/env sh
# cliv - Execute commands using a specific .env and directory
set -eu
_err () { printf "%s\n" "$0: Error: $*" ; exit 1 ; }
HOME="${HOME:-$(getent passwd $(id -u) | cut -d : -f 6)}"
[ -d "$HOME/.cliv" ] || mkdir -p "$HOME/.cliv"
if [ $# -lt 1 ] || [ "$1" = "-h" ] ; then
@RobBlackwell
RobBlackwell / configuration.nix
Last active July 19, 2021 06:27
NixOS on Dell XPS 13
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
alias -g subl=subl
PATH=$PATH:/usr/local/bin/; export PATH
export PATH=/usr/local/heroku/bin
# Exports {{{
export GITHUB_USER="yourgithubusername"
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin # Reorder PATH so local bin is first
export PATH=$PATH:$HOME/anaconda/bin
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'
@jimfdavies
jimfdavies / helpers.sh
Last active November 16, 2021 02:47
AWS CLI helpers
# Security groups that contain 0.0.0.0/0 rules
aws ec2 describe-security-groups --filters Name=ip-permission.cidr,Values=0.0.0.0/0 --output=text | grep SECURITYGROUPS
# Security groups for ElasticSearch
aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=9200 --output=text | grep SECURITYGROUPS
# Search last 10,000/1MB of CloudTrail logs for 'AccessDenied' (removed AWS account number from stream name)
aws logs get-log-events --log-group-name CloudTrail/DefaultLogGroup --log-stream-name 000000000000_CloudTrail_eu-west-1 | grep AccessDenied
# Get number of AWS API calls in time period (assumes a Cloudwatch Logs 'catch-all' filter and metric has been created against CloudTrail logs)
@QuynhVir
QuynhVir / filters.txt
Last active March 26, 2022 18:00
my own uBlock Origin filters
! Remove Facebook sponsored posts
!facebook.com##div[data-pagelet^="FeedUnit"]:has(a[role^=button]:has(> span > span:matches-css(position: relative):has-text(S)))
!facebook.com##div[data-pagelet^="FeedUnit"]:has(div[role^=button]:has(> span > span:matches-css(position: relative):has-text(S)))
!facebook.com##div[data-pagelet^="FeedUnit"]:has(a[aria-label="Sponsored"])
facebook.com##div[role="feed"] div > span > span > a > span:upward(div[role="feed"] > div)
! Remove Facebook "Suggested for You"
!facebook.com##div[data-pagelet^="FeedUnit"]:has(div[role="article"]:has(span > span > span:has-text(Suggested for You)))
! Remove Facebook "New Message"
facebook.com##span:has(div[aria-label="New Message"])
! Remove Facebook "Create Room"
@fikovnik
fikovnik / configuration.nix
Last active July 12, 2022 06:29
NixOS on DELL XPS 13 9360
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
@mzhukovs
mzhukovs / Chase_BankStatement_Checking_PDF_Parser.py
Created September 8, 2018 13:07
Python Script to Scrape Transaction Records from Chase Bank Checking Account Statement PDFs
import os
import argparse
import re
import csv
from datetime import datetime as dt
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LTPage, LTChar, LTAnno, LAParams, LTTextBox, LTTextLine
from pdfminer.pdfpage import PDFPage