Skip to content

Instantly share code, notes, and snippets.

View dmpe's full-sized avatar
💭
🎾

John dmpe

💭
🎾
View GitHub Profile
@martiner
martiner / ihned-pw.user.js
Created October 30, 2015 19:20
iHned Paywall Remover
// ==UserScript==
// @name iHned Paywall Remover
// @namespace http://ihned.cz
// @description Removes iHned paywall cookie
// @include http:/ihned.cz/*
// @include http://*.ihned.cz/*
// @version 2
// @grant none
// ==/UserScript==
document.cookie = "pw=; path=/; domain=.ihned.cz; expires=Thu, 01-Jan-1970 00:00:01 GMT;";
@martin77s
martin77s / Remove-Profile.ps1
Last active October 22, 2018 09:32
Remove Profiles from a local or remote computer
#requires -version 3
function Remove-Profile {
param(
[string[]]$ComputerName = $env:ComputerName,
[pscredential]$Credential = $null,
[string[]]$Name,
[ValidateRange(0,365)][int]$DaysOld = 0,
[string[]]$Exclude,
[switch]$IgnoreLastUseTime,
[switch]$Remove
@aaira-a
aaira-a / createlistitem.ps1
Last active February 24, 2021 14:39
create a new list item on sharepoint online using powershell csom
# Add references to SharePoint client assemblies and authenticate to Office 365 site - required for CSOM
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.WorkflowServices.dll”
# Specify tenant admin and site URL
$SiteUrl = "mysiteurl"
$ListName = "mylistname"
$UserName = "myusername"
$SecurePassword = ConvertTo-SecureString "mypassword" -AsPlainText -Force
@jcheng5
jcheng5 / server.R
Last active June 17, 2021 18:37
Shiny example: Diamonds Explorer
library(shiny)
library(ggplot2)
function(input, output) {
dataset <- reactive({
diamonds[sample(nrow(diamonds), input$sampleSize),]
})
output$plot <- renderPlot({
@peterhurford
peterhurford / r-interview.md
Last active January 12, 2022 21:55
R Interview Questions

1.) If I have a data.frame df <- data.frame(a = c(1, 2, 3), b = c(4, 5, 6), c(7, 8, 9))...

1a.) How do I select the c(4, 5, 6)?

1b.) How do I select the 1?

1c.) How do I select the 5?

1d.) What is df[, 3]?

@nicolashery
nicolashery / pandas-heroku.md
Created September 8, 2012 22:35
Deploy Python app using Pandas on Heroku

Deploy Python app using Pandas on Heroku

2012-09-08

This document explains how to deploy a Python app that uses the Pandas library on Heroku.

Heroku builds Numpy (one of Pandas' requirements) fine. However, when trying to deploy an app with both numpy and pandas in its requirements.txt file (or even just pandas), for some reason it fails

@kylemcdonald
kylemcdonald / nginx.conf
Created June 4, 2017 21:19
nginx config for port forwarding to a Jupyter instance on localhost.
user www-data;
worker_processes auto;
pid /run/nginx.pid;
## based on https://gist.github.com/cboettig/8643341bd3c93b62b5c2
events {
worker_connections 1024;
}
@lemiorhan
lemiorhan / post-receive
Last active February 8, 2023 10:06
Post-receive hook to deploy the code being pushed to production branch to a specific folder
#!/bin/bash
target_branch="production"
working_tree="PATH_TO_DEPLOY"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ -n "$branch" ] && [ "$target_branch" == "$branch" ]; then
@superseb
superseb / 1_README.md
Last active February 10, 2023 21:36
Generate Rancher 2 cluster/node agent definitions

Generate Rancher 2 cluster/node agents definitions

This is not official documentation/tooling, use with caution

This generate the Kubernetes definitions of the cattle-cluster-agent Deployment and cattle-node-agent DaemonSet, in case it's accidentally removed/server-url was changed/certficates were changed. It is supposed to run on every cluster Rancher manages. If you have custom clusters created in Rancher, see Kubeconfig for Custom clusters created in Rancher how to obtain the kubeconfig to directly talk to the Kubernetes API (as usually it doesn't work via Rancher anymore). For other clusters, use the tools provided by the provider to get the kubeconfig.

IMPORTANT: You get the cluster/node agents definitions from Rancher, and you apply them to the cluster that is created/managed so you need to switch kubeconfig to point to that cluster before applying them.

Running it

@jamesbrobb
jamesbrobb / multiform.py
Last active July 4, 2023 18:53 — forked from michelts/gist:1029336
django multiform mixin and view that allows the submission of a) All forms b) Grouped forms c) An individual form
class MultiFormMixin(ContextMixin):
form_classes = {}
prefixes = {}
success_urls = {}
grouped_forms = {}
initial = {}
prefix = None
success_url = None