Skip to content

Instantly share code, notes, and snippets.

@ruanbekker
ruanbekker / promtail_docker_logs.md
Last active May 31, 2024 23:52
Docker Container Logging using Promtail
@wrighter
wrighter / download_bars.py
Last active May 22, 2024 07:28
A command line utility to download historical data from Interactive Brokers
#!/usr/bin/env python
import os
import sys
import argparse
import logging
from datetime import datetime, timedelta
from typing import List, Optional
from collections import defaultdict
@kafkasl
kafkasl / sp500_constituents.json
Created March 7, 2019 13:47
List of S&P 500 historical constituents from 2008/01/31 to 2019/02/27. JSON format where each date contains a list of the constituents.
This file has been truncated, but you can view the full file.
{
"2008/01/31":[
"GHC",
"MDP",
"GAS",
"AZO",
"MIL",
"MXA",
"ASH",
"SNA",
@tsrivishnu
tsrivishnu / sed-extract-matched-strings-from-file.md
Last active September 18, 2022 10:10
`sed` to extract matched strings from a file

NOTE: This gist wasn't given so much attention while writing. So please ignore any typos or meaningless sentences.

How to match a pattern and return only a part of the lines from a file.

One might run in a case when they need to extract some information from a log file and get that information into a CSV file.

This once happened to me to look into the logs for an email sendout worked to findout the ids of users to whom we sent the emails to for a particular day. Luckily, our email service prints out to the log, the user object and the type of the email that is sent to that user object. Each line in the log file looks like this

@slouma2000
slouma2000 / vuejs-filter-limit.txt
Last active September 9, 2019 13:25
Vuejs Filter Limit
Vue.filter('limit', function(array, length) {
var limitCount = parseInt(length, 10);
if (limitCount <= 0) {
("development") !== 'production' && _.warn(
'The limit filter requires an argument defining the limit count.'
);
return array;
}
return array.slice(0, limitCount);
});
@ricca509
ricca509 / chrome-web-security.sh
Last active August 10, 2023 08:25
Chrome: Disable web security [OSX]
// OSX
open -na Google\ Chrome --args --disable-web-security --user-data-dir="/tmp/chrome_dev"
@dwilkie
dwilkie / ubuntu_unattended_upgrades_gmail.markdown
Created July 2, 2015 10:28
Setup unattended upgrades on Ubuntu with Gmail

Install the unattended-upgrades package

$ sudo apt-get install unattended-upgrades 

Edit the periodic configuration

$ sudo nano /etc/apt/apt.conf.d/10periodic
@currencysecrets
currencysecrets / countArray.ab
Last active December 18, 2020 20:20
Count Array length in Amibroker. One of the most frustrating aspects when starting out with AmiBroker is being able to count an array's length. To execute this function simply paste the two functions into your code and whenever you want to count the length of an array simply call arrCount( yourArray );
EnableScript("JScript");
<%
function getArrayLength( a ) {
x = VBArray( a ).toArray();
for ( y = 0; y < x.length; y += 1 ) {
if ( x[y] == undefined ) break;
}
return y;
}
@msnodderly
msnodderly / gpg-verify-iso.txt
Created August 1, 2012 21:30
HOWTO: Verify Debian ISO Downloads (from OS X)
HOWTO: Verify Debian ISO Downloads (from OS X)
- Download the required ISO from http://www.debian.org/CD/. Also download the SHA512SUMS and SHA512SUMS.sign files. (of course MD5SUM etc. work fine, but as long as we're being paranoid, we might as well go all the way)
- Install GPGTools if needed https://www.gpgtools.org/
- Verify the signature on SHA512SUMS