Skip to content

Instantly share code, notes, and snippets.

@Coldsp33d
Coldsp33d / create_df.py
Last active September 19, 2024 15:57
Benchmarking different methods for creating empty dataframes from scratch
import pandas as pd
import perfplot
def append(n):
df = pd.DataFrame(columns=['A', 'B', 'C'])
for _ in range(n):
df = df.append({'A': 1, 'B': 12.3, 'C': 'xyz'}, ignore_index=True) # yuck
return df
def list_append(n):
@jaskiratr
jaskiratr / chmod-400.cmd
Created June 29, 2018 01:03
Set permission of file equivalent to chmod 400 on Windows.
# Source: https://stackoverflow.com/a/43317244
$path = ".\aws-ec2-key.pem"
# Reset to remove explict permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r
@coinsandsteeldev
coinsandsteeldev / dialog.html
Last active September 8, 2024 11:18 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<!DOCTYPE html>
<html>
<head>
<script>
var data
var formId = 'form'
function drawForm() {
if (!data) return
var outputEl = document.getElementById(formId);
@astamicu
astamicu / Remove videos from Youtube Watch Later playlist.md
Last active December 26, 2024 09:44
Script to remove all videos from Youtube Watch Later playlist

UPDATED 22.11.2022

It's been two years since the last update, so here's the updated working script as per the comments below.

Thanks to BryanHaley for this.

setInterval(function () {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];

 video.querySelector('#primary button[aria-label="Action menu"]').click();
@andrewroberts
andrewroberts / LogAppsScriptConfig
Created August 10, 2016 22:10
Log and clear the contents of Apps Script properties, triggers, etc
/**
* Clear all of the config
*/
function clearConfig() {
Logger.log('Delete Local Script Properties:')
if (PropertiesService.getScriptProperties() !== null) {
Logger.log(PropertiesService.getScriptProperties().deleteAllProperties())
Logger.log(' Deleted')
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Countries CRUD</title>
<style>
input[type='submit'], button, [aria-label]{
cursor: pointer;
}
#spoiler{
@Iman
Iman / clean.sh
Last active November 19, 2024 18:59
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@dangtrinhnt
dangtrinhnt / utils.gs
Created November 19, 2014 14:10
Convert row data to dictionary using Google Apps Script
function rowToDict(sheet, rownumber) {
var columns = sheet.getRange(1,1,1, sheet.getMaxColumns()).getValues()[0];
var data = sheet.getDataRange().getValues()[rownumber-1];
var dict_data = {};
for (var keys in columns) {
var key = columns[keys];
dict_data[key] = data[keys];
}
return dict_data;
}
@cobyism
cobyism / gh-pages-deploy.md
Last active December 24, 2024 09:55
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).