Skip to content

Instantly share code, notes, and snippets.

View PythonCoderAS's full-sized avatar

PythonCoderAS PythonCoderAS

  • New York City
  • 08:22 (UTC -04:00)
View GitHub Profile
@PythonCoderAS
PythonCoderAS / node.js.yml
Last active May 27, 2022 00:38
Super Simple Typescript Github Action For Validating Code #typescript #github actions #node.js
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
@PythonCoderAS
PythonCoderAS / script.sh
Created May 24, 2022 01:54
Homebrew uninstall deleted cask #hombrew #homebrew cask #cask #git
# Go to the homebrew-cask directory
$ cd $(brew --repository)/Library/Taps/homebrew/homebrew-cask/Casks
# Bring up commit logs for the interested cask
$ git log --full-history -- jbidwatcher.rb
# Find the SHA of the last commit where the file was active. This will usually be the second commit on the list,
# where the first one is the commit where the file got deleted.
# For the jbidwatcher cask, this was 1d5f7ef8dd72f236d1edd100448473bec127a1e4
# Restore the file.
$ git checkout 1d5f7ef8dd72f236d1edd100448473bec127a1e4 -- jbidwatcher.rb
# Run your command
public void interleave(ArrayList<Integer> a1, ArrayList<Integer> a2){
Iterator<Integer> it2 = a2.iterator();
int idx = 0;
while (it2.hasNext()){
idx++;
if (idx < a1.size()){
a1.add(idx, it2.next());
} else {
a1.add(it2.next());
}
public void interleave(ArrayList<Integer> a1, ArrayList<Integer> a2){
Iterator<Integer> it2 = a2.iterator();
int idx = 0;
while (it2.hasnext()){
idx++;
if (idx < a1.size()){
a1.add(idx, it2.next());
} else {
a1.add(it2.next());
}
@PythonCoderAS
PythonCoderAS / script.sh
Created May 21, 2022 19:48
Get markdown URL for Github Repo #github #markdown
#!/bin/bash
DEFAULT="PythonCoderAS" # Change this to your username on GitHub.
function getURL(){
# Usage: getURL <repo name> [optional display name]
REPO="$1"
DISPLAY="${2:-$1}"
if [[ "$REPO" == *"/"* ]]; then
# Do nothing
@PythonCoderAS
PythonCoderAS / script.sh
Created May 14, 2022 14:10
zsh one-liner to get first word from every line in clipboard and separate by spaces #oh-my-zsh #awk #sed
echo `clippaste | awk '{print $1}' | sed 's/://g'` | clipcopy
@PythonCoderAS
PythonCoderAS / gist:c0923bfea82009779acbdca8ad74c772
Last active May 10, 2022 23:57 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@PythonCoderAS
PythonCoderAS / line_to_space.py
Created May 10, 2022 23:45
Python one-liner to convert a newline-separated list of items into a space-separated list of items
import sys;sys.stdout.write(" | ".join(f"\"{word}\"" for word in sys.stdin.read().split("\n")))
@PythonCoderAS
PythonCoderAS / orm.py
Created May 10, 2022 23:09
Template for postgres aerich-compatible tortoise ORM configuration file #tortoise-orm #postgres #asyncpg
from tortoise import Tortoise
project_db = "test"
TORTOISE_ORM = {
"connections": {
"default": {
"engine": "tortoise.backends.asyncpg",
"credentials": {
"user": project_db,
@PythonCoderAS
PythonCoderAS / python-program.service
Created May 10, 2022 23:07
Minimal template for pipenv-powered python service #pipenv #systemd #systemd service
[Unit]
Description=Name
After=network-online.target
[Service]
User=username
WorkingDirectory=/path/to/directory/program/is/in
ExecStart=/usr/local/bin/pipenv run python main.py
[Install]