Skip to content

Instantly share code, notes, and snippets.

View ethagnawl's full-sized avatar
🐢

Pete Doherty ethagnawl

🐢
View GitHub Profile
@HidemotoKisuwa
HidemotoKisuwa / DataImporter.py
Created November 6, 2020 11:55
Insert Data Through API
import httplib2
import os
from apiclient import discovery
from google.oauth2 import service_account
try:
scopes = ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/spreadsheets"]
secret_file = os.path.join(os.getcwd(), 'client_secret.json')
@brecert
brecert / flems.io
Last active October 4, 2022 17:32
yaml to s-expressions
https://flems.io/#0=N4IgtglgJlA2CmIBcA2ArAOgJwA4A0IAzgMYBOA9rLMgNoCMdaATBgOxp4AMAugQGYQEhWqAB2AQzCIkIDAAsALmGoFi5UQvgbkIEAF88YydNkArYavWbtMiGAAO5UgoAEATQCCAWQAyLvhRgLgDkigr2hEgA9FHm9mAYUPAAblEAnpKwwQDcADqi+WqihK4Zyi4AvO7ePhj24qSE8AAUAAb5YORQAK4ISPkuLgC0LlKdpGlILvAAHo7OLrng8ONpS3gudAPDLlDiCuJTEADMLEUlLpwbS3LwVOQuCrek8ACES9sjfN2ixFMAPttBoNZvNXEsAOYveAKCCiCHrFwvQi9VwnJgudFA4HZbIuch8PhNVwElwlUhwiGY0SjFZONY04GDdEYc6uTjYwa4lwIeFPTmY06s9QXOhMfKtACUeQKvxFrlB8GImigAHluvZuq4qu1RM1Oj0ENt9XSJi5mqCnODlmAlpLNpLjXsDuaWWzLvabndYA8nvAXu8QI7Gc1vr9zZaFpDobD4QB9O3m5GowUY9HBpnNN3yj1M7kEokw-F8MkKCnw6m01bYrNC91i+1cvG8iH8xnByWtGX5MPKiDqFz1RrwHxw+AAUTmpGasDHGwEElg9uA23doMalR5Y4whHss4UzWCeGCkowYHE9gtlQAfNMMGW7M1JRmkTDuqQaevCGeL80LVONgge0KlvFdGWZPg-wXcRYBcAAyODMUqCoqi-DAWyeIY6Htf5-mmKcdwOZxCAAdQgJ5D1xE9lwFF4FHfT8p2xPRplgJoXDAplBjohiXFaZoABJgHXPRO2Y7ZRIwUxyDhQ8QmDPR8h7H4+wHIcmi8VFBDHSd7GnWdRHgQhAJoxl3XILVNxobhVxzBpSHENJCE3AyjJ3PdyMPXJ8hPbY+CcGciwgTdODxYKAB4XHsxzvwwuQwoAagS0ymQQVxXM3aKnJoCBuBlJkIEgjKUKqYITxcIpY26eBsTSwcGiaKBN3UkcdKnGc5yQ
@daehahn
daehahn / wsl2-network.ps1
Last active April 21, 2025 03:30
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@doobeh
doobeh / home.html
Created March 4, 2020 22:52
nested form object population
<form method="post" action="">
{{ form.hidden_tag() }}
{{ form.id }}
{{ form.name }}
{% for entry in form.players %}
{{ entry() }}
{% endfor %}
<input type="submit"/>
</form>
@yegappan
yegappan / VimScriptForPythonDevelopers.MD
Last active April 5, 2025 09:17
Vim script for Python Developers

Vim Script for Python Developers

This is a guide to Vim Script development for Python developers. Sample code for the various expressions, statements, functions and programming constructs is shown in both Python and Vim Script. This is not intended to be a tutorial for developing Vim scripts. It is assumed that the reader is familiar with Python programming.

For an introduction to Vim Script development, refer to usr_41.txt, eval.txt and Learn Vimscript the Hard Way

For a guide similar to this one for JavaScript developers, refer to Vim Script for the JavaScripter

This guide only describes the programming constructs that are present in both Python and Vim. The constructs that are unique to Vim (e.g. autocommands, [key-mapping](https://vimhelp.org/map.txt.html#key-m

@magickatt
magickatt / github_clone_using_token.sh
Created September 6, 2019 17:31
Clone a GitHub repository using a Personal Access Token
export GITHUB_USER=magickatt
export GITHUB_TOKEN=secret
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
@kkoomen
kkoomen / vim-auto-plug-upgrade-every-week.md
Last active July 30, 2023 05:47
Vim-Plug: Run PlugUpdate every week automatically

This snippet will check every time you run Vim whether it updated all your Plug packages for you. It will do this once a week automatically for you.

Add the following to your .vimrc:

function! OnVimEnter() abort
  " Run PlugUpdate every week automatically when entering Vim.
  if exists('g:plug_home')
    let l:filename = printf('%s/.vim_plug_update', g:plug_home)
 if !filereadable(l:filename)
@jen20
jen20 / deregister-task-definitions.sh
Created July 22, 2019 18:05
Script to deregister all ECS Task Definitions in a given region
#!/usr/bin/env bash
get_task_definition_arns() {
aws ecs list-task-definitions --region ${AWS_REGION} \
| jq -M -r '.taskDefinitionArns | .[]'
}
delete_task_definition() {
local arn=$1
@seanh
seanh / vimgrep.md
Last active April 20, 2025 13:50
vimgrep cheatsheet

vimgrep

  • Vimcasts on vimgrep

  • Uses native vim regexes (which are slightly different from the regexes used by grep, ack, ag, etc) so the patterns are the same as with vim's within-file search patterns.

You can do a normal within-file search first, then re-use the same pattern to

import re
from django.db import models
from graphene.relay import PageInfo
from graphene_django.fields import DjangoConnectionField
from graphql_relay.connection.arrayconnection import cursor_to_offset, offset_to_cursor
class SimplifiedDjangoConnectionField(DjangoConnectionField):
"""A simplified extension of DjangoConnectionField