Skip to content

Instantly share code, notes, and snippets.

from collections import defaultdict
import numpy
from timeit import timeit
DATA = {"value": 1}
def square_bracket():
assert DATA["value"] is not None
@markis
markis / praw-chat-post.py
Last active September 4, 2019 00:52
Simplest example of creating chat post using praw
from praw import Reddit
# Get a Reddit instance
# https://praw.readthedocs.io/en/latest/code_overview/reddit_instance.html#
reddit = Reddit(
client_id="<client_id>",
client_secret="<client_secret>",
username="<user>",
password="<password>",
@markis
markis / aoe2hd.md
Created March 18, 2019 21:03 — forked from yocontra/aoe2hd.md
Age of Empires II HD - For Mac OSX
openssl genrsa -out server.key 2048
openssl req -key server.key -sha256 -x509 -nodes -new -days 3650 -out server.crt -subj "/CN=Local Development" \
-reqexts SAN -extensions SAN \
-config <(cat /usr/local/etc/openssl@1.1/openssl.cnf \
<(printf '[SAN]\nsubjectAltName=DNS:dev.local'))
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain server.crt
sudo nginx -s stop && sudo nginx
@markis
markis / vpn.js
Created August 1, 2017 17:55
Automatic vpn using openconnect
#!/usr/bin/env node
const proc = require('child_process');
const crypto = require('crypto');
const config = require('./config');
connect()
function connect() {
var step = 0;
Set-ExecutionPolicy Bypass
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
lxrun /install /y
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install googlechrome slack -y
choco install visualstudiocode phpstorm -y
choco install sqlnotebook -y
sudo apt install -y autoconf automake build-essential python-dev libtool libssl-dev pkg-config
cd /tmp
git clone https://github.com/facebook/watchman.git -b v4.9.0 --depth 1
cd watchman/
./autogen.sh
./configure --enable-lenient
make
sudo make install
@markis
markis / prs.js
Created September 14, 2016 18:23
#!/usr/bin/env node
const clear = '\033c';
(function() {
"use strict";
const https = require('https'),
config = require('./config'),
// array of usernames to filter
people = config.people,
// server for your bit bucket server
/* Go to https://www.facebook.com/pokes/ and run the following */
setInterval(() => {
for (let node of document.getElementsByTagName('a')) {
if (node.textContent === "Poke Back") {
node.click();
}
}
}, 100)
@markis
markis / gist:43f7d433104b1713560b
Last active August 29, 2015 14:23
Script to monitor twitter and post to hipchat
#!/usr/bin/env python
import httplib, json
try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser # ver. < 3.0
# config and globals
tweetMessages = []