Skip to content

Instantly share code, notes, and snippets.

View klepsydra's full-sized avatar

Marcos Koby klepsydra

  • US
View GitHub Profile
@johntyree
johntyree / getBlockLists.sh
Last active March 9, 2024 12:32
Make one large blocklist from the bluetack lists on iblocklist.com
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@andris9
andris9 / git-cache-meta.sh
Created March 5, 2012 13:15
git-cache-meta
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
# 2012-03-05 - added filetime, andris9
@klepsydra
klepsydra / sync-fail2ban.sh
Last active January 11, 2024 15:11
Block globally reported hack attempts using your local iptables firewall rules
#!/bin/bash
## Update fail2ban iptables with globally known attackers.
## Actually, runs 100% independently now, without needing fail2ban installed.
##
## /etc/cron.daily/sync-fail2ban
##
## Author: Marcos Kobylecki <fail2ban.globalBlackList@askmarcos.com>
## http://www.reddit.com/r/linux/comments/2nvzur/shared_blacklists_from_fail2ban/
@ChecksumFailed
ChecksumFailed / ReadMe.md
Created October 17, 2023 20:53
SerivceNow Widget Exploit Testing

Powershell script to to test simple lis

@solyarisoftware
solyarisoftware / idle.rb
Last active July 11, 2023 20:58
Ruby script to test how to fetch IMAP mails (IDLE "push" mode) without pulling (in "real-time")
# Encoding: utf-8
#
# idle.rb
#
# goal:
# Ruby script to test how to fetch IMAP mails with IDLE mode.
# IMAP IDLE allow a sort of "push" / "real-time" delivery.
#
# I used the script to test LATENCY (end-to-end delivery times)
@thertrader
thertrader / ShinyForTradingStrategy.txt
Last active June 17, 2023 15:59
A Simple Shiny App for Monitoring Trading Strategies
This Shiny application is designed to help analysing trading strategies. It is an ongoing project that I improve when time allows. Feel free to get in touch should you have any suggestion.
*How to use the App as it is?
The App uses as input several csv files (one for each strategy). Each file has two columns: date and daily return. There is an example of such a file in the Github repository. The code is essentially made of 3 files.
-ui.R: controls the layout and appearance of the app
-server.R: contains the instructions needed to build the app. You can load as much strategies as you want as long as the corresponding csv file has the right format (see below).
-shinyStrategyGeneral.R: loads the required packages and launches the app
put ui.R and server.R file in a separate directory
In the server.R file change the inputPath, inputFile and keepColumns parameters to match your setting. The first two are self explanatory the third one is a list of column names within the csv file. Keep only date and daily return
@emaraschio
emaraschio / SOLID.markdown
Last active May 24, 2023 07:18
SOLID Principles with ruby examples

#SOLID Principles with ruby examples

##SRP - Single responsibility principle A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.

@yoshyoshi
yoshyoshi / tradingbot.py
Created July 24, 2018 04:56
trading bot code snippet
from datetime import datetime
import numpy as np
import talib
import alpaca_trade_api as tradeapi
api = tradeapi.REST(key_id=<your key id>,secret_key=<your secret key>)
barTimeframe = "1H" # 1Min, 5Min, 15Min, 1H, 1D
assetsToTrade = ["SPY","MSFT","AAPL","NFLX"]
positionSizing = 0.25
@danvbe
danvbe / 1-Explanations.md
Last active April 21, 2023 15:39
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@subelsky
subelsky / casperjs_example.js
Created August 8, 2012 18:51
Webscraping with CasperJS, PhantomJS, jQuery, and XPath
var system = require('system');
if (system.args.length < 5) {
console.info("You need to pass in account name, username, password, and path to casperJS as arguments to this code.");
phantom.exit();
}
var account = system.args[1];
var username = system.args[2];
var password = system.args[3];